From 0e2e49c345378ac7edcdd086acf379791ed798be Mon Sep 17 00:00:00 2001 From: Alexander Janssen Date: Sun, 29 Dec 2013 20:41:25 +0100 Subject: [PATCH] ZeroMQ implementation (not the best solution but quick and simple) public function startZmq($loop) { $context = new \React\ZMQ\Context($loop); $pull = $context->getSocket(\ZMQ::SOCKET_PULL); $pull->bind('tcp://127.0.0.1:5555'); $pull->on('message', array($this, 'onPushNotification')); } https://github.com/JDare/ClankBundle/issues/7 --- Server/Type/WebSocketServerType.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Server/Type/WebSocketServerType.php b/Server/Type/WebSocketServerType.php index 369b2a5..50eaa77 100644 --- a/Server/Type/WebSocketServerType.php +++ b/Server/Type/WebSocketServerType.php @@ -48,7 +48,14 @@ private function setupServer() $this->loop = \React\EventLoop\Factory::create(); $this->socket = new \React\Socket\Server($this->loop); - + + foreach ($this->container->getParameter('jdare_clank.topic_services') as $topic) { + $service = $this->container->get($topic['service']); + if (method_exists($service, 'startZmq')) { + $service->startZmq($this->loop); + } + } + if ($this->host) { $this->socket->listen($this->port, $this->host); @@ -142,4 +149,4 @@ public function getSession() return $this->session; } -} \ No newline at end of file +}