Closed r1me closed 6 years ago
谢谢反馈,我将用ws://echo.websocket.org 来调试Diocp的客户端类。
Thanks, I've made a patch and I hope it will be helpful in solving the issue. With the patch it passes upgrade to WebSocket (server returns valid handshake): https://github.com/r1me/diocp-v5/commit/55dd7b74dd63c7aaa65888d7c66b4c0c909be7f7
HTTP/1.1 101 Web Socket Protocol Handshake
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: content-type
Access-Control-Allow-Headers: authorization
Access-Control-Allow-Headers: x-websocket-extensions
Access-Control-Allow-Headers: x-websocket-version
Access-Control-Allow-Headers: x-websocket-protocol
Access-Control-Allow-Origin: echo.websocket.org
Connection: Upgrade
Date: Wed, 27 Dec 2017 12:17:11 GMT
Sec-WebSocket-Accept: N6RXLen0Bm6yVjpcC322KTdMD7Q=
Server: Kaazing Gateway
Upgrade: websocket
But then server closes connection with error 1002, probably due to missing ping/acknowledgment ?
PS. I/O Completion Ports are awesome :-)
已经修复,请再测试一下
Works as intended. Thank you. :+1:
TDiocpWebSocketTcpClient
doesn't seem to be compatible with non DIOCP servers. For example while trying to connect tows://echo.websocket.org
, the server will return error 400 (bad request). This happens due to missing headers likeSec-WebSocket-Key
andSec-WebSocket-Version
. I've tried to update the class by adding those headers inTDiocpWebSocketContext.PostWebSocketRequest
, then server returned a valid handshake (101) but right after that closed the connection with close code 1002 (protocol error). I guess your implementation of WebSocket is based on first versions of this "protocol". Are you planning to update this class ?