Currently I have the following situation. My socket.io (socket.io 1.1.0) application works, but when it fails it makes infinite amount of attempts to reconnect. I want to have some upper limit. Say if after 5 reconnects the app is still failing - then stop it and say the message to the user.
After searching for some time I thought that I was partially able to solve my problem with
var socket = new io.connect('http://localhost:8181', {
'reconnect': true,
'reconnection delay': 500,
'reconnection limit': 5,
'max reconnection attempts': 5
});
The problem is that it absolutely does not work. Application still tries to reconnect infinite amount of time. In addition I still have no idea how to make a callback when the number of reconnections was achieved.