Socket IO WebSocket请求被企业防火墙阻止。 [英] Socket IO WebSocket requests blocked by corporate firewalls.

查看:1317
本文介绍了Socket IO WebSocket请求被企业防火墙阻止。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从企业防火墙/代理后面使用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屋!

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