我的服务已更新为Node.js v6.9.4,Socket.io的连接现已频繁断开。
它没有在开发环境中复制,并决定通过在更新之前返回状态来恢复。
这个问题仅适用于某些版本吗? 更新到最新的Node.js会解决问题吗?
感谢您的合作。
更新版本
Dim i As New Item
i = LstAll.SelectedItem
TextBox1.Text = i.Txt
断开状态
关于浏览器的日志(devtools)
断开连接之前请求(轮询)的响应时间是85秒," 400 Bad request"在下一个请求中输出错误。
(正常状态下的响应时间为25秒)
node.js@6.1.0 → 6.9.4
socket.io@1.4.6 → 1.7.2 # Client and server are the same version
express@4.13.4 → 4.14.0
body-parser@1.15.1 → 1.15.2
jquery@2.2.3 → 3.1.1
jsdom@9.0.0 → 9.9.1
关于服务器日志 Node.js的日志中没有任何线索。 以下错误输出到Pound日志,但因果关系未知。
GET https://myapp.com/socket.io/?node...sport=polling.. 200 OK 24.99ms
POST https://myapp.com/socket.io/?node...sport=polling.. 200 OK 1ms
GET https://myapp.com/socket.io/?node...sport=polling.. 200 OK 25.01ms
POST https://myapp.com/socket.io/?node...sport=polling.. 200 OK 0ms
GET https://myapp.com/socket.io/?node...sport=polling.. 200 OK 1m 25s
POST https://myapp.com/socket.io/?node...sport=polling.. 400 Bad Request..
------ detail ------
NetworkError : 400 Bad Request - https://myapp.com/socket.io.......
--------------
POST https://myapp.com/socket.io/?node...sport=polling.. 400 Bad Request..
------ detail ------
NetworkError : 400 Bad Request - https://myapp.com/socket.io.......
--------------
基础设施信息
pound: (7f8592ce7700) e501 bad request "HQ" from xxx.xxx.xxx.xxx
pound: (7f84cdbe5700) BackEnd yyy.yyy.yyy.yyy:9443 dead (killed)
* "xxx.xxx.xxx.xxx" or "yyy.yyy.yyy.yyy" is the IP address.
连接代码
服务器代码
Browser ─[ HTTPS ]─ Load balancer(Pound) ─[ HTTP ]─┬─ Node.js Server 1
├─ Node.js Server 2
├─ Node.js Server 3
└─ Node.js Server 4
客户代码
var socketApp = express();
...
var server = new serverBuilder({protcol: 'http', port: 9999}).getInstance(socketApp).listen(process.env.VMC_APP_PORT || 9999, function(){
});
var io = socketio.listen(server, {cookie: false});
io.use(function(socket, callback){
try {
var hndReq = null;
if (socket.handshake) {
hndReq = socket.handshake;
}
if (!socket.handshake.query.param1) {
socket.disconnect('unauthorized');
return;
}
.....
callback();
});
io.sockets.on("connection", function (socket) {
try {
var hndReq = null;
if (socket.handshake) {
hndReq = socket.handshake;
}
socket.on("disconnect", function () {
....
});
} catch (e) {
console.log(e);
throw e;
}
});