IE and Socket.io compatibility
Asked Answered
P

1

6

I make some chat example like here: http://psitsmike.com/2011/09/node-js-and-socket-io-chat-tutorial/

When I use Chrome and Firefox everything works like a charm. With IE9 or Opera some socket.io events are not firing (e.g. disconnect) or firing too late, and data receiving is too slow.

I installed node.js and socket.io module with the npm method.

Please help.

Peripatetic answered 20/10, 2012 at 23:51 Comment(0)
N
9

Socket.IO works best with websockets. Prior to 2012, most browsers did not support websockets (source).

With such browsers, socket.io falls back to various polling methods, but those may lead to problems you are experiencing, such as low data rate and delayed events (firing 1-2 minutes late). To remedy, this you should try to enable flash sockets.

 io.set('transports', [
     'websocket'
   , 'flashsocket'
   , 'htmlfile'
   , 'xhr-polling'
   , 'jsonp-polling'
 ]);

Also, make sure the flash policy port (default 10843) is reachable from the client.

Norri answered 21/10, 2012 at 13:42 Comment(4)
htmlfile is an ActiveX way for IEGaither
When I try this, the io object doesn't have a 'set' method. This is client side, after including socket.io.jsTactic
Thanks for this Martin, resolved my issue with IE9 causing a read error ECONNRESET on clicking Refresh. Now it fires the disconnect correctly and immediately kills my user. Khior - I did this in my server side file, directly after requiring socket.ioSpeak
Minor edit: Most pre-2012 browsers did not support WebSockets, not just Opera. The first support came in IE 10 (9/2012), Firefox 11 (1/2012), Chrome 16 (10/2011), Safari 7 (10/2013), Opera 12 (11/2012), iOS 6 (1/2013), Android 4.4 (12/2013). Source: caniuse.com/#feat=websocketsTweezers

© 2022 - 2024 — McMap. All rights reserved.