Under heavy load, client connecting to a socket.io may miss the first packet with node.js -
i on node.js v4.1.1 , working socket.io
when client connected server socket , start exchanging packages @ time first packet missed on server.
have guys idea reason behind this? please note have around 900 connection @ time.
var http = module.exports = require('http'); var app = module.exports = express(); var httpsoptions = { key: fs.readfilesync('server.key'), cert: fs.readfilesync('certificate.crt') }; var server = https.createserver(httpsoptions, app); var io = module.exports = require('socket.io').listen(server); io.set("transports", ["xhr-polling", "web socket", "polling", "htmlfile"]); io.sockets.on("connection", function(socket) { client.on('msg', function(request) { console.log("event --> " + request); }); client.on('error', function(exc) { console.log("ignoring exception: " + exc); }); client.on('ping', function(request) { client.emit('pong', request); client.removelistener('ping', function() {}); }); client.on('disconnect', function(reason) { console.log("socket disconnect " + reason); }); });
in case error not in socket or node.js. error in mongodb , mongodb take load event's late. new connection take load in sign process.we increase configuration of mongodb , working well.
Comments
Post a Comment