2

I was wondering if it would be possible to host a node.js socket.io app in IIS 7 using iisnode? I've read that WebSockets are only supported in IIS 8 but I also read that it might be possible so I am a little bit confused.

Thanks!

vladb
  • 21
  • 2
  • 1
    Socket.io falls back to long-polling/JSONP if websockets aren't supported. – Ben Fortune Nov 24 '14 at 12:27
  • 1
    Thanks for your answer. However, after setting up IIS 7 with iisnode and socket.io I get that the: WebSocket connection to 'ws://localhost:85/socket.io/?EIO=3&transport=websocket&sid=jBY7LlQ_2yttKnDPAAAC' failed: Error during WebSocket handshake: Unexpected response code: 501. Any hints on how to solve this? – vladb Nov 24 '14 at 13:06

1 Answers1

0

From what I've read IIS 8 is the first version of IIS with WebSockets, until then longpolling is used.

As for the output in your comment, you will see that because the Socket.io client is going to attempt to establish a connection by default with longpolling and then will attempt to upgrade the connection to WebSockets, unless you explicitly specify that it shouldn't. This can be done in the options passed to the server and the client at instantiation via the transports Array.

An explanation of how Socket.io works is available here

See the documentation for the Socket.io Server Engine here and the Socket.io Client Engine here

peteb
  • 18,552
  • 9
  • 50
  • 62