Open anngdev opened 7 years ago
It happens only on heroku server. it works fine on local server. My server code is:
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
io.on('connection', function(socket){
socket.on('chatmessage', function(msg){
console.log('listening on *:'+process.env.PORT || 5000);
io.emit('chatmessage', msg);
});
});
http.listen(process.env.PORT || 5000, function(){
console.log('listening on *:'+process.env.PORT || 5000);
});
https://morning-peak-67693.herokuapp.com/
Where are you issuing your connect function... i had this issue a few weeks ago and fixed it by moving my connect function to the App Delegate so that it is called only once.
[self.socket connect] is called only once, I was add breakpoint and I sure about that. The problem is it only happen on heroku (with the same server code) :(
@codeninja88 how did you solve it , can you be more specific?
When I disconnected it for about 30s (turn off/on wifi/3g on iPhone), it will reconnect with 2 more connections.
If I set @"reconnectWait":@2, it will be 1 more connections.
I'm using version 8.2.0