_protocol; $this->_protocol = $protocol; return $old; } /** * Get protocol implementation. * * @return \Hoa\Websocket\Protocol\Generic */ public function getProtocolImplementation() { return $this->_protocol; } /** * Set handshake success. * * @param bool $handshake Handshake. * @return bool */ public function setHandshake($handshake) { $old = $this->_handshake; $this->_handshake = $handshake; return $old; } /** * Whether the handshake succeed. * * @return bool */ public function getHandshake() { return $this->_handshake; } /** * Append a fragment to a message (if we have fragmentation). * * @param string $fragment Fragment. * @return string */ public function appendMessageFragment($fragment) { ++$this->_numberOfFragments; return $this->_messageFragments .= $fragment; } /** * Get the fragmented message. * * @return string */ public function getFragmentedMessage() { return $this->_messageFragments; } /** * Get number of fragments. * * @return int */ public function getNumberOfFragments() { return $this->_numberOfFragments; } /** * Set whether the message is complete or not. * * @param bool $complete Is it complete? * @return bool */ public function setComplete($complete) { $old = $this->_complete; $this->_complete = $complete; return $old; } /** * Check if the message is complete or not. * * @return bool */ public function isMessageComplete() { return $this->_complete; } /** * Whether the message is binary or not. * * @param bool $binary Binary. * @return bool */ public function setBinary($binary) { $old = $this->_isBinary; $this->_isBinary = $binary; return $old; } /** * Check if the message is binary or not. * * @return bool */ public function isBinary() { return $this->_isBinary; } /** * Clear the fragmentation. * * @return void */ public function clearFragmentation() { $this->_messageFragments = null; $this->_numberOfFragments = 0; $this->_isBinary = false; $this->_complete = true; return; } }