protected function createServiceStream(Socket $socket)
    {
        $socket->setId('worker_service');
        $this->getPoller()->add($socket, ZMQ::POLL_IN);

        $that = $this;
        $this->serviceStream = $socket->getStream();
        $this->serviceStream->addListener(StreamInterface::MESSAGE, function (MessageEvent $event) use ($that) {
            if (null === $event->getProtocolMessage()) {
                $message = $event->getMessage();

                $that->getLogger()->error('Non-protocol message detected in service stream: '.$message);

                return;
            }

            $that->onServiceMessage($event->getProtocolMessage());
        });
    }
protected function createServiceStream(Socket $socket)
    {
        $socket->setId('worker_service');
        $this->getPoller()->add($socket, ZMQ::POLL_IN);

        $that = $this;
        $this->serviceStream = $socket->getStream();
        $this->serviceStream->addListener(StreamInterface::MESSAGE, function (MessageEvent $event) use ($that) {
            if (null === $event->getProtocolMessage()) {
                $message = $event->getMessage();

                $that->getLogger()->error('Non-protocol message detected in service stream: '.$message);

                return;
            }

            $that->onServiceMessage($event->getProtocolMessage());
        });
    }
protected function createServiceStream ( Socket $ socket ) { $ socket -> setId ( 'worker_service' ) ; $ this -> getPoller ( ) -> add ( $ socket , ZMQ :: POLL_IN ) ; $ that = $ this ; $ this -> serviceStream = $ socket -> getStream ( ) ; $ this -> serviceStream -> addListener ( StreamInterface :: MESSAGE , function ( MessageEvent $ event ) use ( $ that ) { if ( null === $ event -> getProtocolMessage ( ) ) { $ message = $ event -> getMessage ( ) ; $ that -> getLogger ( ) -> error ( 'Non-protocol message detected in service stream: ' . $ message ) ; return ; } $ that -> onServiceMessage ( $ event -> getProtocolMessage ( ) ) ; } ) ; }
Creates a socket to communicate with the service.

@param Socket $socket

@return null
Creates a socket to communicate with the service .