Exemplo n.º 1
0
 /**
  * Process a Message Frame
  *
  * Appends or creates a new message and attaches it to the user sending it.
  *
  * When the last frame of a message is received, the message is sent for processing to the
  * abstract WebSocket::onMessage() method.
  *
  * @param WebSocketFrame $frame
  */
 protected function processMessageFrame(WebSocketFrame $frame)
 {
     if ($this->_openMessage && $this->_openMessage->isFinalised() == false) {
         $this->_openMessage->takeFrame($frame);
     } else {
         $this->_openMessage = WebSocketMessage::fromFrame($frame);
     }
     if ($this->_openMessage && $this->_openMessage->isFinalised()) {
         $this->emit("message", array('message' => $this->_openMessage));
         $this->_openMessage = null;
     }
 }