Exemplo n.º 1
0
 public function __construct($id = null, $center = null)
 {
     $this->center = $center ?: NotificationCenter::getInstance();
     $this->id = $this->center->getSubscriberId($id);
     $this->subscriber = new ZMQSocket($this->center->getContext(), ZMQ::SOCKET_SUB);
     $this->subscriber->setSockOpt(ZMQ::SOCKOPT_IDENTITY, $this->id);
     // prevent break
     $this->subscriber->setSockOpt(ZMQ::SOCKOPT_SUBSCRIBE, $this->id);
     // subscribe by client Id
     $this->subscriber->connect($this->center->getSubscribePoint());
     $this->requester = $this->center->createRequester();
 }
Exemplo n.º 2
0
 public function __construct($center = null)
 {
     $this->center = $center ?: NotificationCenter::getInstance();
     $this->connectDevice($this->center->getPublishPoint(true), $this->center->getSubscribePoint(true));
 }