socketsiiswebsocketsocket.io

Web Socket: IIS WebSocket Protocol feature need to be enabled for Socket.io?


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.

WebSocket Protocol

  1. 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).

  2. 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.


Solution

  • 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.