IE and Socket.io compatibility

↘锁芯ラ 提交于 2020-01-01 05:16:48

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/12993704/ie-and-socket-io-compatibility

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!