SocketCluster / socketcluster-client

JavaScript client for SocketCluster
MIT License
292 stars 91 forks source link

How do I handle a connection error? #38

Closed seiyria closed 8 years ago

seiyria commented 8 years ago

I'm not sure if I'm supposed to try/catch (since the socket repeatedly tries to connect), watch for an event, or what. I've read this but it only covers errors that I publish. I'm trying to watch for a "socket hung up" which appears to be thrown when the client can't connect to the server, so I can pop up a message in my application saying that the server isn't reachable.

jondubois commented 8 years ago

@seiyria socket.on('error', function (err) {...}) to handle errors on the client socket.

seiyria commented 8 years ago

Awesome, thank you! Is there somewhere in the documentation that lists built-in events?