Пример #1
0
 public function sendFrame(Frame $frame) : \Generator
 {
     if ($this->disconnected) {
         throw new WebSocketException('Cannot send message to disconnected web socket');
     }
     if ($this->logger) {
         $this->logger->debug('OUT <{id}> {frame}', ['id' => $this->id, 'frame' => (string) $frame]);
     }
     $this->time = time();
     yield from $this->socket->write($frame->encode());
 }
 protected function sendFrame(Frame $frame) : \Generator
 {
     yield from $this->stream->write($frame->encode(random_bytes(4)));
 }