morozovsk\websocket\Daemon::_onMessage PHP Method

_onMessage() protected method

protected _onMessage ( $connectionId )
    protected function _onMessage($connectionId)
    {
        if (isset($this->_handshakes[$connectionId])) {
            if ($this->_handshakes[$connectionId]) {
                //if the client has already made a handshake
                return;
                //then there does not need to read before sending the response from the server
            }
            if (!$this->_handshake($connectionId)) {
                $this->close($connectionId);
            }
        } else {
            while (($data = $this->_decode($connectionId)) && mb_check_encoding($data['payload'], 'utf-8')) {
                //decode buffer (there may be multiple messages)
                $this->onMessage($connectionId, $data['payload'], $data['type']);
                //call user handler
            }
        }
    }