Socket IO WebSocket请求被企业防火墙阻止。 [英] Socket IO WebSocket requests blocked by corporate firewalls.
问题描述
从企业防火墙/代理后面使用socket.io模块的解决方案是什么?这是我使用的代码。
What is the solution to using socket.io module from behind corporate firewall/proxy? This is the code I am using.
// setup express server
var app = express()
var serv = http.createServer(app);
serv.listen(80);
// setup socket io - listens in on express store as well for sessions
var io = require('socket.io').listen(serv);
推荐答案
我有一个类似的问题,我最终失去了websocket完全:
I had a similar issue and I ended up disabling websocket entirely:
io.configure('production', function(){
io.set('transports', ['xhr-polling']);
});
XHR投票功能无处不在,但每个人都有更大的开销(即使只有5%的用户实际需要它)
XHR-polling works everywhere, but has a much bigger overhead for everyone (even if only 5% of users actually need it).
好消息是,即将推出的1.0版本的Socket.IO将会解决这个问题:
Good news is, the upcoming 1.0 version of Socket.IO will fix this:
与以前的Socket.IO核心不同,它始终首先建立一个长轮询连接,然后尝试升级到更好的运输,这是测试在一边。
Unlike the previous Socket.IO core, it always establishes a long-polling connection first, then tries to upgrade to better transports that are "tested" on the side.
在此查看: https:// github .com / LearnBoost / engine.io
这篇关于Socket IO WebSocket请求被企业防火墙阻止。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!