示例#1
0
 public function send($packets)
 {
     foreach ($packets as $packet) {
         $data = Parser::encodePacket($packet, $this->supportsBinary);
         $this->socket->send($data);
         $this->emit('drain');
     }
 }
示例#2
0
 public function send($packets)
 {
     $this->writable = false;
     if ($this->shouldClose) {
         echo 'appending close packet to payload';
         $packets[] = array('type' => 'close');
         call_user_func($this->shouldClose);
         $this->shouldClose = null;
     }
     $data = Parser::encodePayload($packets, $this->supportsBinary);
     $this->write($data);
 }
示例#3
0
 public function onData($data)
 {
     $this->onPacket(Parser::decodePacket($data));
 }