Skip to content


Subversion checkout URL

You can clone with
Download ZIP


reconnect not working in v1.0 #1683

KaviSharma opened this Issue · 5 comments

4 participants


I have this code to connect and disconnect connection-

var socket = io.connect("/dashbaord", {'forceNew': true});
socket.on('connect', function (socket) {
    $"new connection established");

socket.on('disconnect', function (socket) {
    $"connection disconnected");

//socket connection works here

socket.disconnect(); // disconnect event fire here
socket.connect(); // connect event not fire here

//socket connection does not work here


I think you may need to call io.connect again instead of socket.connect as the forceNew option is destroying the socket and as a result cannot be reused.


@matthaywardwebdesign But the old connect remains in memory applications


OK so I tried these:
1. with {forceNew: false} option: connect - disconnect - connect -> same result, socket does not work.
2. after disconnect, executed this code
socket = io.connect("/dashbaord", {'forceNew': false});
$log(socket.connected); //false here
//same result
//socket does not work here.

socket = io.connect("/dashbaord", {'forceNew': true});
//socket works here, but need to reattach all events.


Look at this debug:
screen shot 2014-07-18 at 3 48 46 pm

not sure what forceNew: false does. And can we reuse/reconnect an existing connection ? setting up a new connection every time io.connect is tedious as have to attach all events again. And old connection objects still exists in memory.


Should work after merging socketio/

@rase- rase- closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.