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;
    }