Closed chasseurmic closed 9 years ago
The disconnection happens after a short time (some 20/30 sec) of inactivity on the socket.
I will make some tests. Can you create a small example of the server?
This is the server side (index.js) with express and socket.io as dependencies. It's very basic:
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var devices = [];
app.get('/', function(req, res){
res.sendFile(__dirname + '/index.html');
});
io.on('connection', function(socket){
console.log('a user connected');
socket.on('disconnect', function(){
console.log('user disconnected');
});
});
http.listen(3000, function(){
console.log('listening on *:3000');
});
Thank you.
I'm suspicious that is a problem with the WebSocket heartbeat.
Hope it helps! Thanks.
Possible solution with #7
I replaced the WebSocket implementation. It was something that I wanted to do and I hope that it fixes this problem.
If your are using CocoaPods, please do pod update
and test it again.
Thanks.
Seems to work right now. Good job! +1
Awesome!
I added a new event: TransportError
.
Example:
on(.TransportError) {
switch $0 {
case .Failure(let error):
println("WebSocket error: \(error)")
default:
break
}
}
I am trying out the library and cannot understand why I get unexpected disconnections from the client that I cannot debug. The server (socket.io 1.3.5) gives me a disconnection warning, but on my iOS device the
on(.Disconnected)()
function never gets called. Any idea if this is an issue? The disconnection happens after a short time (some 20/30 sec) of inactivity on the socket.