コード例 #1
0
ファイル: ZmqDebug.php プロジェクト: Bit-Wasp/node-php
 /**
  * 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']);
 }