【发布时间】:2017-01-27 13:26:57
【问题描述】:
我有一个应用程序,通过 iisnode 到 Node.js/Express/Socket.io 应用程序与 websockets 完美配合。
Windows 服务器 2012
iisnode 2.21
IIS 8.5
节点 6.2.1
socket.io 1.4.8
express.js 4.14
然而,当通过 HTTPS 访问时,WebSockets 在看似成功 wss 协商后会退回到轮询:
GET wss://x.com/socket/a145e1f7-c8e7-4b26-96d3-a4d9869b5f3a/?id=a145e1f7-c8e7-4b26-96d3-a4d9869b5f3a&EIO=3&transport=websocket&sid=2nKT2dHWKrmO5xaHAAAM HTTP/1.1
Host: x.com
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: https://x.com
Sec-WebSocket-Version: 13
DNT: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: en-US,en;q=0.8
Cookie: io=2AAAM; _ga=GA1.2.452745265.1462472455; connect.sid=s%3M8aVwM; rl-sticky-key=!1z8WBml+V4=
Sec-WebSocket-Key: qocdK/MRQ==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Server: Microsoft-IIS/8.5
server: Microsoft-IIS/8.5
Connection: Upgrade
sec-websocket-accept: VOFznVr/l4fsY=
sec-websocket-extensions: permessage-deflate
x-powered-by: ASP.NET
X-Powered-By: ASP.NET
Date: Mon, 19 Sep 2016 18:20:04 GMT
但是这个WebSocket里面没有帧,Socket.io返回HTTP轮询。如果TLS由IIS处理,那么在wss协议协商后如何影响WebSockets?
【问题讨论】:
-
我正在尝试同样的解决方案,iisnode 和 socketio,我遇到的问题是设置路由。你有没有在 iis 或 iisnode 中展示这一点的好例子?
标签: node.js websocket socket.io iisnode