@signalwire/js
Advanced tools
Comparing version 1.2.4-beta.2 to 1.2.4
@@ -6,3 +6,6 @@ # Changelog | ||
<!-- ## [Unreleased] --> | ||
## [1.2.4] - 2019-12-04 | ||
### Fixed | ||
- Keep trying to reconnect WS in case of network failure - even if it never has been connected. | ||
## [1.2.4-beta.2] - 2019-12-02 | ||
@@ -9,0 +12,0 @@ ### Changed |
@@ -22,5 +22,6 @@ import * as log from 'loglevel'; | ||
protected _keepAliveTimeout: any; | ||
protected _reconnectTimeout: any; | ||
protected _reconnectDelay: number; | ||
protected _autoReconnect: boolean; | ||
private _idle; | ||
protected _idle: boolean; | ||
private _executeQueue; | ||
@@ -45,4 +46,3 @@ private _pong; | ||
protected _onSocketOpen(): Promise<void>; | ||
protected _onSocketClose(): void; | ||
protected _onSocketError(error: Error): void; | ||
protected _onSocketCloseOrError(event: any): void; | ||
protected _onSocketMessage(response: any): void; | ||
@@ -49,0 +49,0 @@ protected _removeSubscription(protocol: string, channel?: string): void; |
@@ -35,3 +35,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
this._reconnectDelay = 5000; | ||
this._autoReconnect = false; | ||
this._autoReconnect = true; | ||
this._idle = false; | ||
@@ -43,4 +43,3 @@ this._executeQueue = []; | ||
this._onSocketOpen = this._onSocketOpen.bind(this); | ||
this._onSocketClose = this._onSocketClose.bind(this); | ||
this._onSocketError = this._onSocketError.bind(this); | ||
this._onSocketCloseOrError = this._onSocketCloseOrError.bind(this); | ||
this._onSocketMessage = this._onSocketMessage.bind(this); | ||
@@ -105,2 +104,3 @@ this._handleLoginError = this._handleLoginError.bind(this); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
clearTimeout(this._reconnectTimeout); | ||
this.subscriptions = {}; | ||
@@ -183,3 +183,4 @@ this._autoReconnect = false; | ||
} | ||
_onSocketClose() { | ||
_onSocketCloseOrError(event) { | ||
logger.error(`Socket ${event.type} ${event.message}`); | ||
if (this.relayProtocol) { | ||
@@ -199,8 +200,5 @@ deRegisterAll(this.relayProtocol); | ||
if (this._autoReconnect) { | ||
setTimeout(() => this.connect(), this._reconnectDelay); | ||
this._reconnectTimeout = setTimeout(() => this.connect(), this._reconnectDelay); | ||
} | ||
} | ||
_onSocketError(error) { | ||
logger.error(error.message); | ||
} | ||
_onSocketMessage(response) { | ||
@@ -253,4 +251,4 @@ const { method, params } = response; | ||
this.on(SwEvent.SocketOpen, this._onSocketOpen); | ||
this.on(SwEvent.SocketClose, this._onSocketClose); | ||
this.on(SwEvent.SocketError, this._onSocketError); | ||
this.on(SwEvent.SocketClose, this._onSocketCloseOrError); | ||
this.on(SwEvent.SocketError, this._onSocketCloseOrError); | ||
this.on(SwEvent.SocketMessage, this._onSocketMessage); | ||
@@ -260,4 +258,4 @@ } | ||
this.off(SwEvent.SocketOpen, this._onSocketOpen); | ||
this.off(SwEvent.SocketClose, this._onSocketClose); | ||
this.off(SwEvent.SocketError, this._onSocketError); | ||
this.off(SwEvent.SocketClose, this._onSocketCloseOrError); | ||
this.off(SwEvent.SocketError, this._onSocketCloseOrError); | ||
this.off(SwEvent.SocketMessage, this._onSocketMessage); | ||
@@ -264,0 +262,0 @@ } |
import Relay from './src/SignalWire'; | ||
import Verto from './src/Verto'; | ||
export declare const VERSION = "1.2.4-beta.2"; | ||
export declare const VERSION = "1.2.4"; | ||
export { Relay, Verto }; |
import Relay from './src/SignalWire'; | ||
import Verto from './src/Verto'; | ||
import { setAgentName } from '../common/src/messages/blade/Connect'; | ||
export const VERSION = '1.2.4-beta.2'; | ||
export const VERSION = '1.2.4'; | ||
setAgentName(`JavaScript SDK/${VERSION}`); | ||
export { Relay, Verto }; |
@@ -47,2 +47,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this._idle = false; | ||
const { login, password, passwd, userVariables } = this.options; | ||
@@ -49,0 +50,0 @@ const msg = new Login(login, (password || passwd), this.sessionid, userVariables); |
{ | ||
"name": "@signalwire/js", | ||
"version": "1.2.4-beta.2", | ||
"version": "1.2.4", | ||
"description": "Relay SDK for JavaScript to connect to SignalWire.", | ||
@@ -9,2 +9,3 @@ "author": "SignalWire Team <open.source@signalwire.com>", | ||
"module": "dist/esm/js/index.js", | ||
"types": "dist/esm/js/index.d.ts", | ||
"files": [ | ||
@@ -11,0 +12,0 @@ "dist" |
Sorry, the diff of this file is too big to display
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
394728
0
6836