/** * {@inheritdoc} */ public function run() { $this->ratchetApp = new App($this->getHttpHost(), $this->getPort(), $this->getIpAddress(), $this->loop); foreach ($this->apps as $app) { // TODO introduce session config for this: $sessionApp = new SessionProvider($app['app'], $this->sessionHandler); $this->ratchetApp->route($app['route'], $app['app'], $app['allowedOrigins'], $app['httpHost']); } $this->ratchetApp->run(); }
private function runWebsocketListener() { try { $this->wsConnection->route('/' . $this->config->get('daemons.wsserver.path'), $this, array('*')); echo ' [*] Websockets broker daemon waiting for messages. To exit press CTRL+C', "\n"; $this->wsConnection->run(); } catch (\Exception $e) { $this->logger->error(__METHOD__ . ' | ' . $e->getMessage()); } }
/** * Execute the console command. * * @return mixed */ public function fire() { $socket = new Socket($this->url, $this->port); require_once app_path() . '/Socket/routes.php'; $this->info('Laravel web socket server started on ' . $this->url . ':' . $this->port . '/'); $socket->run(); }
/** * Execute the console command. * * @return mixed */ public function fire() { $socket = new Socket($this->httpHost, $this->port, $this->address); require base_path('routes/socket.php'); $this->info('Laravel web socket server started on ' . $this->httpHost . ':' . $this->port . '/' . 'address:' . $this->address); $socket->run(); }
/** * Execute the console command. * * @return mixed */ public function fire() { $socket = new Socket($this->httpHost, $this->port, $this->address); require_once app_path() . '/Socket/routes.php'; $this->info('Laravel web socket server started on ' . $this->httpHost . ':' . $this->port . '/' . 'address:' . $this->address); $socket->run(); }
/** * @param InputInterface $input * @param OutputInterface $output * @return int|null|void */ protected function execute(InputInterface $input, OutputInterface $output) { //Init rena /** @var RenaApp $app */ $app = RenaApp::getInstance(); // Init react event loop $loop = Factory::create(); // Init the ZMQ push points (?) $killsWebsocket = new killsWebsocket(); $stompOut = new sendToStomp(); // Setup ZMQ for killmails being sent around $context = new Context($loop); $pull = $context->getSocket(ZMQ::SOCKET_PULL); $pull->bind("tcp://" . $app->baseConfig->getConfig("host", "zmq", "127.0.0.1") . ":" . $app->baseConfig->getConfig("port", "zmq", 5555)); $pull->on("message", array($killsWebsocket, "onMessage")); $pull->on("message", array($stompOut, "onMessage")); // Setup ratchets websocket endpoint $ratchet = new App($app->baseConfig->getConfig("host", "websocket", "localhost"), $app->baseConfig->getConfig("port", "websocket", 8800), $app->baseConfig->getConfig("ip", "websocket", "0.0.0.0"), $loop); // Add routes here, / is entry and is just spamming kills, everything else is seperate $ratchet->route("/", $killsWebsocket, array("*")); // Default route is killmails $ratchet->route("/kills", $killsWebsocket, array("*")); // Seems someone uses this too for killmails $ratchet->route("/echo", new echoWebsocket(), array("*")); // Echo route, all it'll do is echo out whatever is sent to it $ratchet->run(); }
protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln('Starting chat server.'); $app = new Ratchet\App("localhost", 8080, '0.0.0.0'); $app->route('/chat', new Chat(), array('*')); $app->run(); $output->writeln('Chat server stopped'); }
/** * Run the server application through the WebSocket protocol * * @throws \Sonar\Exceptions\AppServiceException * @throws \Sonar\Exceptions\SocketServiceException * @return null */ 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(); }
protected function about() { $this->info("================================="); $this->info("Integrated Central System"); $this->info("================================="); $this->info(''); $this->info("[" . date('d M Y h:i:s') . "] Create By Emay"); $this->info("================================="); $chat = new Chat(); $echoserver = new EchoServer(); $app = new App('localhost', 8080); $app->route('/chat', $chat); $app->route('/echo', $echoserver, array('*')); $app->run(); $this->info("================================="); }
<?php use Ratchet\Session\SessionProvider; use Symfony\Component\HttpFoundation\Session\Storage\Handler; use Ratchet\App; use App\Mains; date_default_timezone_set('Asia/Jakarta'); require dirname(__DIR__) . '/vendor/autoload.php'; $memcache = new Memcache(); $memcache->connect('localhost', 11211); $mains = new SessionProvider(new Mains(), new Handler\MemcacheSessionHandler($memcache)); $app = new App('pos.localhost', 8080); $app->route('POS/Mains', $mains); $app->run();
<?php // Your shell script use Ratchet\Session\SessionProvider; use Symfony\Component\HttpFoundation\Session\Storage\Handler; use Ratchet\App; $memcache = new Memcache(); $memcache->connect('localhost', 11211); $session = new SessionProvider(new MyApp(), new Handler\MemcacheSessionHandler($memcache)); $server = new App('localhost'); $server->route('/intercambio_de_perfiles/index/dashboard', $session); $server->run();