Web Socket:需要为 Socket.io 启用 IIS WebSocket 协议功能吗?
对于我的一个应用程序,我使用 socket.io 实现了 Web 套接字并托管在 IIS 中。目前套接字连接有助于在客户端(React)和服务器(node.js)之间提供两种方式的连接。
正如我所提到的,我已在 IIS 中托管了我的应用程序。我对打开或关闭 Windows 功能没有什么疑问 ->互联网信息服务->万维网服务 ->应用程序开发功能-> WebSocket 协议。我在没有启用此功能的情况下测试了我的应用程序,它工作正常,但我想确认以下内容。
我真的需要启用 WebSocket 协议功能才能使 websocket 在我的应用程序中工作吗?如果是这样,现在如何在不启用的情况下正常工作(我还没有进行性能和压力测试,我可能会遇到这方面的问题)。
如果我不启用此功能怎么办?简而言之,这个功能的实际用途是什么?
如果有人回答上述问题将会很有帮助。提前致谢。
For one of my application, I have implemented Web socket using socket.io and hosted in IIS. Currently socket connection helping to provide two way connection between client (React) and server (node.js).
As I mentioned, I have hosted my application in IIS. I have few doubts regarding Turn Windows features on or off -> Internet Information services -> World wide Web Services -> Application Development Features -> WebSocket Protocol. I have tested my application without enabling this feature, its working fine, but I would like to confirm below stuffs.
Do I really need to enable WebSocket protocol feature to make websocket work in my application? If so, how now it is working fine without enabling (I haven't do performance and stress testing, I may face issue on this).
What if I not enabling this feature? in short what is the actual use of this feature?
It would be helpful if anyone answer the above questions. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
WebSocket 作为 HTTP 堆栈的一部分需要在 Windows 上准备好很多东西(跨多个组件),所以希望这个答案能有所帮助。
因此,HTTP.sys 中默认启用 WebSocket 支持,如果您的框架 (socket.io) 没有依赖项,则不需要 IIS 模块。
请注意,“摘要”部分提供了几个有用的链接,
https://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support#summary
(和同一篇文章还指出 IIS WebSocket 模块有
与socket.io冲突。但我怀疑这是否仍然适用。)
另请注意,如果您通过 HttpPlatformHandler 托管 Node.js Web 应用程序,则 IIS WebSocket 模块是必需的。如果没有它,HttpPlatformHandler 就无法将 WebSocket 流量转发到 Node.js。
WebSocket as part of the HTTP stack requires a bunch of things to be ready on Windows (across multiple components), so hope this answer helps a little.
So WebSocket support is by default on in HTTP.sys, and you don't need the IIS module if your framework (socket.io) has no dependency there.
Note that the "Summary" section provides several useful links,
https://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support#summary
(and the same article also indicates that IIS WebSocket module has
conflicts with socket.io. But I doubt this is still applicable.)
Also note that if you are hosting Node.js web apps via HttpPlatformHandler, however, IIS WebSocket module is mandatory. Without it, HttpPlatformHandler cannot forward WebSocket traffic to Node.js.