recv() публичный Метод

接收数据
public recv ( integer $length = 65535, boolean $waitall = false ) : string | boolean
$length integer 接收数据的长度
$waitall boolean 等待接收到全部数据后再返回,注意这里超过包长度会阻塞住
Результат string | boolean | bool
Пример #1
0
 /**
  * 接收数据
  * @return bool | Swoole\Http\WebSocketFrame
  * @throws Swoole\Http\WebSocketException
  */
 function recv()
 {
     if (!$this->handshake) {
         trigger_error("not complete handshake.");
         return false;
     }
     while (true) {
         $data = $this->socket->recv();
         if (!$data) {
             return false;
         }
         $frame = $this->parser->pop($data);
         if ($frame) {
             return $frame;
         }
     }
     return false;
 }