socket.io 无限 timeout
发布于 11 年前 作者 shaniu00 8630 次浏览 最后一次编辑是 8 年前

服务端 io.sockets.on(‘connection’,function(socket){

socket.on(‘geta’,function(data){ io.sockets.emit(‘dd’,{tt:58}); });

socket.on(‘getb’,function(data){ io.sockets.emit(‘ee’,{bbss:“xxdd.com”}); });

socket.on(‘disconnect’,function(){ console.log(“断开了”); io.sockets.emit(‘lossLine’,{lossLine:111}); }); });

客户端 var socket = io.connect(“http://xx.yy.com”); socket.on(‘connect’,function(){ socket.emit(‘geta’,{itemId:itemId}); socket.on(‘geta’,function(data){

       });
       socket.on('lossLine',function(data){
              console.log(data);
       });

});

linux 服务器上

4 debug - setting poll timeout debug - discarding transport debug - cleared close timeout for client cmDBXWPwZSXHxHtLlpdE debug - clearing poll timeout debug - xhr-polling writing 8:: debug - set close timeout for client cmDBXWPwZSXHxHtLlpdE debug - xhr-polling closed due to exceeded duration debug - setting request GET /socket.io/1/xhr-polling/cmDBXWPwZSXHxHtLlpdE?t=1375087802876 debug - setting poll timeout debug - discarding transport debug - cleared close timeout for client cmDBXWPwZSXHxHtLlpdE debug - clearing poll timeout debug - xhr-polling writing 8:: debug - set close timeout for client cmDBXWPwZSXHxHtLlpdE debug - xhr-polling closed due to exceeded duration

页面firebug 一直 自动重连 打开页面 要过二十多秒 才收到数据

页面上写了 一个onlick方法 socket.emit(‘getb’,{itemId:itemId}); 接受都蛮正常的

2 回复

怪了, 以前跑 Demo 是没在问题的呀, 是不是 Firefox 的问题, Chrome 呢?

解决了 nginx 版本太低

回到顶部