コード例 #1
0
ファイル: Client.php プロジェクト: sahilmalhan/dubdub
 /**
  * Receives data sent by the server
  *
  * @return array<Payload> Payload received since the last call to receive()
  */
 public function receive()
 {
     if (!$this->isConnected()) {
         return false;
     }
     $data = $this->socket->receive();
     if (!$data) {
         return $data;
     }
     $old = $this->received;
     $this->payloadHandler->handle($data);
     return array_diff_assoc($this->received, $old);
 }
コード例 #2
0
ファイル: Connection.php プロジェクト: luoshulin/falcon
 /**
  * Handle data received from the client
  *
  * The data passed in may belong to several different frames across one or
  * more protocols. It may not even contain a single complete frame. This method
  * manages slotting the data into separate payload objects.
  *
  * @todo An endpoint MUST be capable of handling control frames in the
  *        middle of a fragmented message.
  * @param string $data
  * @return void
  */
 public function handle($data)
 {
     $this->payloadHandler->handle($data);
 }