$localSocket = new SocketServer($loop);
$localServer = new HttpReceiver($localSocket, $middleware);
$localSocket->listen($localPort, '0.0.0.0');
// remote loggers can push updates
// configure routes
$routes = new RouteCollection();
$router = new Router(new UrlMatcher($routes, new RequestContext()));
// WAMP adapter
$wampRoutes = Util\Configuration::read('push.routes.wamp');
if (is_array($wampRoutes) && count($wampRoutes)) {
    $wampAdapter = new WampClientAdapter();
    $wampServer = new WsServer(new WampServer($wampAdapter));
    foreach ($wampRoutes as $path) {
        addRoute($path, $wampServer);
    }
    $middleware->addAdapter($wampAdapter);
} else {
    $output->writeln("<info>No routes configured for WAMP protocol. Disabling WAMP.</info>");
}
// WebSocket adapter
$wsRoutes = Util\Configuration::read('push.routes.websocket');
if (is_array($wsRoutes) && count($wsRoutes)) {
    $wsAdapter = new WsClientAdapter();
    $wsServer = new WsServer($wsAdapter);
    foreach ($wsRoutes as $path) {
        addRoute($path, $wsServer);
    }
    $middleware->addAdapter($wsAdapter);
} else {
    $output->writeln("<info>No routes configured for WebSocket protocol. Disabling websockets.</info>");
}