bodacydo
bodacydo

Reputation: 79299

How to make socket.io client not-to reconnect?

How do I make socket.io client (latest version 1.1.0) not to reconnect to server in case of disconnect? I tried finding it in manual but it's not obvious.

Upvotes: 0

Views: 184

Answers (1)

jfriend00
jfriend00

Reputation: 707158

Ahh, it looks like there's a simple solution to avoid reconnect logic. When you connect from the client, it is usually with something like this:

var socket = io(url);

Just add an options object afterwards like this:

var socket = io(url, {reconnection: false});

It's documented here: http://socket.io/docs/client-api/

Upvotes: 3

Related Questions