Skip to content Skip to sidebar Skip to footer

Sailssocket Keep Trying To Reconnect

After struggling with socket.io connection authentication (here and here) and thanks to @sgress454, I realized how to get this to work and I am sending the authentication/authoriza

Solution 1:

The short answer to your question is that you can set the reconnection flag to turn automatic reconnection on or off:

// Disable auto-reconnect for all new socket connections
io.sails.reconnection = false;

// Disable auto-reconnect for a single new socket connectionvar mySocket = io.sails.connect({reconnection: false});

As far as SailsSocket creation, you are correct in that io.sails.connect() is the only way to create a SailsSocket. Since the connection is asynchronous, any event handlers you bind immediately after calling connect will be added before the actual connection takes place, so you won't miss any notifications.

Post a Comment for "Sailssocket Keep Trying To Reconnect"