PHPDaemon\Servers\WebSocket\Connection::handshake PHP Method

handshake() public method

Called when we're going to handshake.
public handshake ( ) : boolean
return boolean Handshake status
    public function handshake()
    {
        $this->route = $this->pool->getRoute($this->server['DOCUMENT_URI'], $this);
        if (!$this->route) {
            Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Cannot handshake session for client "' . $this->addr . '"');
            $this->finish();
            return false;
        }
        if (method_exists($this->route, 'onBeforeHandshake')) {
            $this->route->onWakeup();
            $ret = $this->route->onBeforeHandshake(function () {
                $this->handshakeAfter();
            });
            if ($this->route) {
                $this->route->onSleep();
            }
            if ($ret !== false) {
                return;
            }
        }
        $this->handshakeAfter();
    }