public function run() {

        if(!$this->server) {

            try {

                // initialize socket server
                $this->server = new AppServer($this->config->socket->host, $this->config->socket->port);

                // create application with dependencies
                $app = new Sonar(
                    new StorageService($this->config->storage),
                    new QueueService($this->config->beanstalk),
                    new GeoService(),
                    new CacheService()
                );
                $this->server->route('/sonar', $app, ['*']);
            }
            catch(QueueServiceException $e) {
                throw new AppServiceException($e->getMessage());
            }
            catch(ConnectionException $e) {
                throw new SocketServiceException($e->getMessage());
            }
            catch(StorageServiceException $e) {
                throw new AppServiceException($e->getMessage());
            }
            catch(CacheServiceException $e) {
                throw new AppServiceException($e->getMessage());
            }

        }

        if(isset($this->config->storage) === false) {
            throw new AppServiceException('There is no option `storage` in your configurations');
        }

        $this->server->run();
    }