0

在我的 Win32 应用程序中,我正在尝试使用套接字连接 websocket(ws://localhost:3000),如下所示,

 std:string reqLine = "GET /default HTTP/1.1\r\n"             // Request line
 std::string header =  "Connection: Upgrade\r\n"
                       "Sec-WebSocket-Key: GCeEn+pBGdrdj4mcrtBukA==\r\n" 
                       "Sec-WebSocket-Version: 13\r\n"
                       "Upgrade: websocket\r\n"
                       "\r\n";

std::string req = reqLine + header;
::send(m_socket, req, req.size());

Inturn, I am getting response as follows,
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: 4W7fNwDGO1aKNr50PzdRDJaYIGE=

这很好用。

现在,我想使用套接字连接 websocket 安全(wss://localhost:443)。在这种情况下,请求行和标题是什么。

请建议。

4

0 回答 0