IE和Socket.io兼容性 [英] IE and Socket.io compatibility

查看:328
本文介绍了IE和Socket.io兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在此处创建了一些聊天示例: http ://psitsmike.com/2011/09/node-js-and-socket-io-chat-tutorial/

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

当我使用Chrome和Firefox时,所有功能都像魅力一样.使用IE9或Opera时,某些socket.io事件不会触发(例如,断开连接)或触发得太晚,并且数据接收太慢.

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.

我使用npm方法安装了node.js和socket.io模块.

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

请帮助.

推荐答案

Socket.IO与websockets一起使用效果最佳.在2012年之前,大多数浏览器不支持websocket( ).

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

使用这样的浏览器,socket.io会使用各种轮询方法,但是这些方法可能会导致您遇到问题,例如数据速率低和事件延迟(延迟1-2分钟触发).为此,您应该尝试启用闪存插槽.

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'
 ]);

另外,请确保客户端可以访问闪存策略端口(默认值为10843).

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

这篇关于IE和Socket.io兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆