Ejemplo n.º 1
0
 /**
  * ZmqDebug constructor.
  * @param NodeInterface $node
  * @param Context $context
  */
 public function __construct(NodeInterface $node, Context $context)
 {
     $this->socket = $context->getSocket(\ZMQ::SOCKET_PUB);
     $this->socket->bind('tcp://127.0.0.1:5566');
     $node->on('event', function ($event, array $params) {
         $this->log($event, $params);
     });
     $node->headers()->on('tip', [$this, 'logTip']);
     $node->blocks()->on('block', [$this, 'logBlock']);
     $node->chains()->on('retarget', [$this, 'logRetarget']);
 }
Ejemplo n.º 2
0
 /**
  * @param array[string]string $connUris
  */
 private function initSockets(array $connUris)
 {
     // Create context
     $this->reactLoop = ReactFactory::create();
     /** @var ReactZmqContext|\ZMQContext $reactZmqContext */
     $reactZmqContext = new ReactZmqContext($this->reactLoop);
     $this->hbSocket = $reactZmqContext->getSocket(\ZMQ::SOCKET_REP);
     $this->hbSocket->bind($connUris['hb']);
     $this->iopubSocket = $reactZmqContext->getSocket(\ZMQ::SOCKET_PUB);
     $this->iopubSocket->bind($connUris['iopub']);
     $this->controlSocket = $reactZmqContext->getSocket(\ZMQ::SOCKET_ROUTER);
     $this->controlSocket->bind($connUris['control']);
     $this->stdinSocket = $reactZmqContext->getSocket(\ZMQ::SOCKET_ROUTER);
     $this->stdinSocket->bind($connUris['stdin']);
     $this->shellSocket = $reactZmqContext->getSocket(\ZMQ::SOCKET_ROUTER);
     $this->shellSocket->bind($connUris['shell']);
 }