socket: Ensure the SockJS object is closed when reconnecting

Without an explicit close, we will continue to get messages on the old
connection, even once we replace the _sockjs property.  This leads to
"impossible" situations, such as receiving ACKs after reconnecting.

(imported from commit f8927fdf0551610e5b9d1db29bba00e160e76b6d)
This commit is contained in:
Zev Benjamin
2013-12-04 14:41:09 -05:00
parent 1843262672
commit 6eeee0a4f3

View File

@@ -231,6 +231,7 @@ Socket.prototype = {
this._is_authenticated = false;
this._is_reconnecting = true;
this._reconnect_initiation_time = now;
this._sockjs.close();
this._reconnect_timeout_id = setTimeout(function () {
that._reconnect_timeout_id = null;