Comparing version 6.3.0 to 6.4.0
@@ -129,2 +129,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
}; | ||
var MAX_CONNECTION_TRY_COUNT = 10; | ||
@@ -149,2 +150,3 @@ var Client = function () { | ||
this._uri = uri; | ||
this._connectionTryCount = 0; | ||
@@ -203,2 +205,7 @@ this._transportFactory = typeof transportFactory === 'function' ? transportFactory : function () { | ||
if (this._connectionTryCount >= MAX_CONNECTION_TRY_COUNT) { | ||
throw new Error('Could not connect: Max connection try count of ' + MAX_CONNECTION_TRY_COUNT + ' reached. Please check you network and refresh the page.'); | ||
} | ||
this._connectionTryCount++; | ||
this._closing = false; | ||
@@ -217,2 +224,3 @@ return this._transport.open(this.uri).then(function () { | ||
_this.listening = true; | ||
_this._connectionTryCount = 0; | ||
return session; | ||
@@ -228,10 +236,15 @@ }); | ||
_this2.listening = false; | ||
// try to reconnect in 1 second | ||
setTimeout(function () { | ||
if (!_this2._closing) { | ||
_this2._transport = _this2._transportFactory(); | ||
_this2._initializeClientChannel(); | ||
_this2.connect(); | ||
} | ||
}, 1000); | ||
if (!_this2._closing) { | ||
// Use an exponential backoff for the timeout | ||
var timeout = 100 * Math.pow(2, _this2._connectionTryCount); | ||
// try to reconnect after the timeout | ||
setTimeout(function () { | ||
if (!_this2._closing) { | ||
_this2._transport = _this2._transportFactory(); | ||
_this2._initializeClientChannel(); | ||
_this2.connect(); | ||
} | ||
}, timeout); | ||
} | ||
}; | ||
@@ -238,0 +251,0 @@ |
{ | ||
"name": "blip-sdk", | ||
"version": "6.3.0", | ||
"version": "6.4.0", | ||
"description": "BLiP SDK JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/blip-sdk.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38012
666