Socket.io,https和express连续连接/断开循环

时间:2013-06-07 11:04:33

标签: node.js express socket.io

我试图在节点上一起使用socket.io,express和https。当socket.io连接时,immediatley断开连接,再次重新连接并循环。可以使用以下代码重新创建问题...

服务器

var app = express();
var server = https.createServer(sslOptions, app)
var io = require('socket.io').listen(server);
app.use(express.static('./public'));
server.listen(port, function(){});

客户端

<script type="text/javascript" src="/socket.io/socket.io.js"></script>
<script>
    var socket = io.connect('https://testdomain.com', { secure: true });
</script>

错误

debug - client authorized
info  - handshake authorized uBDQXqTmgbJzm-lnSWsm
debug - setting request GET /socket.io/1/websocket/uBDQXqTmgbJzm-lnSWsm
debug - set heartbeat interval for client uBDQXqTmgbJzm-lnSWsm
debug - client authorized for
debug - websocket writing 1::
warn  - websocket parser error: reserved fields must be empty
info  - transport end (undefined)
debug - set close timeout for client uBDQXqTmgbJzm-lnSWsm
debug - cleared close timeout for client uBDQXqTmgbJzm-lnSWsm
debug - cleared heartbeat interval for client uBDQXqTmgbJzm-lnSWsm
debug - discarding transport

1 个答案:

答案 0 :(得分:1)

通过卸载Node v0.10.9并安装v0.10.10。

来解决