我写了 Websocket 服务器。我认为它会返回一切美好的东西,也许我会错过一些东西。这是浏览器发送给它的内容:
GET /app HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: pm.local:4444
Origin: http://pm.local
Pragma: no-cache
Cache-Control: no-cache
Sec-WebSocket-Key: dkX2mQo3cBVA0DMQ7m9oTw==
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: x-webkit-deflate-frame
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36
并且服务器发送该响应:
HTTP/1.1 101 WebSocket Protocol Handshake
Upgrade: WebSocket
Connection: Upgrade
Sec-WebSocket-Origin: http://pm.local
Sec-WebSocket-Location: http://pm.local/app
Sec-WebSocket-Accept: KrfNVY/hsidqg2HX7YBdXHD/SQM=
Sec-WebSocket-Protocol: sample
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: content-type
Access-Control-Allow-Origin: http://pm.local
当然,最后它总是发送'\r\n'。
你知道这个回复有什么问题吗?感谢帮助