udidu
udidu

Reputation: 8588

How to catch server failure in the client?

In socket.io, when the server is down the client is trying to reconnect to the server and gets the error GET http:/localhost:8181/socket.io/1/?t=1334276656018, that, obviously, because the server is not running and cant serve the connection to the client.

Is there any way to catch this error in the client side? Something like socket.on("error", function(...){}); can be very handy in this case...

Any suggestions?

Upvotes: 4

Views: 1728

Answers (1)

udidu
udidu

Reputation: 8588

Sorry about the bother.. i found the solution:

    socket.on('disconnect', function(){
        HANDLE HERE
    });

Upvotes: 6

Related Questions