public function handshake() { $clientKey = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'; $hash = base64_encode(sha1($this->key . $clientKey, true)); $this->httpResponse->addHeaders(["Upgrade" => "websocket", "Connection" => "Upgrade", "Sec-WebSocket-Accept" => $hash, "Sec-WebSocket-Protocol" => $this->protocol]); }