I'm using Socket.IO (the latest version 1.1.0) to exchange messages with an Android app (the client).
I would like to set a timeout (5s for example) to check if my client is still connected or not (I would like to handle the case when the Android app crashes). Moreover, I would like to generate an event when a this timeout occurs.
What I want to do looks like this:
1/ Set the timeout
var socket = require('socket.io')({
//options go here
'timeout': 5000 //set the timeout to 5s
});
2/ Handle timeout event:
socket.on('timeout', function(){
//my treatment
});
But I don't find any implementation to handle the timeout.
Thanks for your help !
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…