private function generateSwitchResponse($client, $request)
    {
        $acceptHeader = sha1($request->getHeader("sec-websocket-key") . self::WEBSOCKET_GUID, true);
        $switchParams = array(
            "Upgrade" => "websocket",
            "Connection" => "Upgrade",
            "Sec-WebSocket-Accept" => base64_encode($acceptHeader)
        );
        $response = new HttpResponse("", $switchParams, HttpCode::SWITCHING_PROTOCOLS);
        $response = $this->clientsHandler->onUpgrade($client, $request, $response);

        return $response;
    }
private function generateSwitchResponse($client, $request)
    {
        $acceptHeader = sha1($request->getHeader("sec-websocket-key") . self::WEBSOCKET_GUID, true);
        $switchParams = array(
            "Upgrade" => "websocket",
            "Connection" => "Upgrade",
            "Sec-WebSocket-Accept" => base64_encode($acceptHeader)
        );
        $response = new HttpResponse("", $switchParams, HttpCode::SWITCHING_PROTOCOLS);
        $response = $this->clientsHandler->onUpgrade($client, $request, $response);

        return $response;
    }
private function generateSwitchResponse ( $ client , $ request ) { $ acceptHeader = sha1 ( $ request -> getHeader ( "sec-websocket-key" ) . self :: WEBSOCKET_GUID , true ) ; $ switchParams = array ( "Upgrade" => "websocket" , "Connection" => "Upgrade" , "Sec-WebSocket-Accept" => base64_encode ( $ acceptHeader ) ) ; $ response = new HttpResponse ( "" , $ switchParams , HttpCode :: SWITCHING_PROTOCOLS ) ; $ response = $ this -> clientsHandler -> onUpgrade ( $ client , $ request , $ response ) ; return $ response ; }
Generates WebSocket upgrade response & notifies clients handler

@param HttpClient|StreamServerNodeInterface $client WebSocketClient which should be upgraded to WebSocket
protocol
@param HttpRequest $request Original HTTP upgrade handshake sent by client

@return HttpResponse
Generates WebSocket upgrade response & notifies clients handler