服务正常运行,用其他工具(如https://www.piesocket.com/)可以正常连接服务:
Request URL:
ws://localhost:10086/socket.io/?EIO=4&transport=websocket&sid=7MlJsrp5EwRtRwtyAAAK
Request Method:
GET
Status Code:
101 Switching Protocols
Connection:
Upgrade
Sec-Websocket-Accept:
oQy4ziHssD7iDfNfa1XCn5t1kN8=
Upgrade:
websocket
Accept-Encoding:
gzip, deflate, br
Accept-Language:
en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,zh-TW;q=0.6
Cache-Control:
no-cache
Connection:
Upgrade
Host:
localhost:10086
Origin:
https://www.piesocket.com
Pragma:
no-cache
Sec-Websocket-Extensions:
permessage-deflate; client_max_window_bits
Sec-Websocket-Key:
Y21XM9zAZ0P7VTSV7xtemw==
Sec-Websocket-Version:
13
Upgrade:
websocket
User-Agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
但是使用postman 测试本地后端的socket io显示 connect ECONNREFUSED:
Error: connect ECONNREFUSED 127.0.0.1:10086
Handshake Details
Request URL: http://localhost:10086/socket.io/?EIO=4&transport=websocket
Request Method: GET
Request Headers
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: asJcQZtVbPfTp0HQ/oxpgg==
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Host: localhost:10086
使用postman可以正常测试其他的http api。