Merge pull request #708 from rase-/fix/reconnect_failed-double-fire

Fix duplicate `reconnect_failed` event
This commit is contained in:
Tony Kovanen
2014-06-21 17:28:30 +03:00

View File

@@ -151,7 +151,8 @@ Manager.prototype.timeout = function(v){
*/
Manager.prototype.maybeReconnectOnOpen = function() {
if (!this.openReconnect && !this.reconnecting && this._reconnection) {
// Only try to reconnect if it's the first time we're connecting
if (!this.openReconnect && !this.reconnecting && this._reconnection && this.attempts === 0) {
// keeps reconnection from firing twice for the same reconnection loop
this.openReconnect = true;
this.reconnect();