-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constantly Connecting/Disconnecting with socket connection. #48
Comments
Hello! Do you have a test case that could be used to reproduce the problem? Thank you, |
Dear "indutny", Sorry for the very delayed response. But please look below for the server code: var cluster = require('cluster');
var clusterWorkerSize = require('os').cpus().length;
var sticky = require('sticky-session');
var server = require('http').createServer(function(req, res) {
res.end('worker: ' + cluster.worker.id);
});
if (!sticky.listen(server, 14001)) {
console.log('master');
server.once('listening', function() {
console.log('server started on 14001 port');
});
} else {
console.log('worker: ' + cluster.worker.id);
var io = require('socket.io')(server);
io.on('connection', function(socket){
var userID = socket.id;
console.log("connected "+userID);
socket.on('disconnect', function() {
console.log('Got disconnect!'+userID);
});
});
} But please look below for the client code: var io = require('socket.io-client');
var serverUrl = 'http://localhost:14001';
var conn = io.connect(serverUrl);
conn.on('connect', function () {
var sessionId = conn.io.engine.id;
console.log(sessionId);
}); |
Hi "indutny", Can you please help me, i am glued in this. Thnaks |
Sorry for delay on my side this time. What's expected output of this? This is what I get on the server:
|
Hi , Your seems to be perfect, but this is what i got from server:
and respectively from client is :
|
That's pretty strange. May I ask you to run server with |
Hi, I could replicate this behaviour in Node 0.12.4 but found that upgrading to 4.4.7 resolves the issue for me. Jon. |
Hi,
I am using node 4.2 and need to build server that would be connected to a client via socket.
Since the application is not a web, my socket connection is breaking and re-connecting continuously.
Please guide me if i am doing something wrong.
NOTE: I am initializing the socket io in worker.
Thanks in advance.
The text was updated successfully, but these errors were encountered: