@signalwire/js
Advanced tools
Comparing version 1.3.0-cantina.38 to 1.3.0-cantina.39
@@ -20,2 +20,3 @@ import * as log from 'loglevel'; | ||
protected _refreshTokenNotificationDiff: number; | ||
protected _expiredDiffSeconds: number; | ||
protected _doKeepAlive: boolean; | ||
@@ -61,3 +62,3 @@ protected _keepAliveTimeout: any; | ||
private _closeConnection; | ||
private _checkTokenExpiration; | ||
protected _checkTokenExpiration(): void; | ||
private _keepAlive; | ||
@@ -64,0 +65,0 @@ static on(eventName: string, callback: any): void; |
@@ -35,2 +35,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
this._refreshTokenNotificationDiff = 120; | ||
this._expiredDiffSeconds = 0; | ||
this._doKeepAlive = false; | ||
@@ -73,3 +74,8 @@ this._autoReconnect = true; | ||
get expired() { | ||
return this.expiresAt && this.expiresAt <= (Date.now() / 1000); | ||
if (this.expiresAt) { | ||
const now = Math.floor(Date.now() / 1000); | ||
const diff = this.expiresAt - now; | ||
return diff <= this._expiredDiffSeconds; | ||
} | ||
return false; | ||
} | ||
@@ -76,0 +82,0 @@ get reconnectDelay() { |
import Relay from './src/SignalWire'; | ||
import Verto from './src/Verto'; | ||
import CantinaAuth from '../common/src/webrtc/CantinaAuth'; | ||
export declare const VERSION = "1.3.0-cantina.38"; | ||
export declare const VERSION = "1.3.0-cantina.39"; | ||
export { Relay, Verto, CantinaAuth }; | ||
@@ -6,0 +6,0 @@ export * from '../common/src/webrtc/deviceHelpers'; |
@@ -5,5 +5,5 @@ import Relay from './src/SignalWire'; | ||
import CantinaAuth from '../common/src/webrtc/CantinaAuth'; | ||
export const VERSION = '1.3.0-cantina.38'; | ||
export const VERSION = '1.3.0-cantina.39'; | ||
setAgentName(`JavaScript SDK/${VERSION}`); | ||
export { Relay, Verto, CantinaAuth }; | ||
export * from '../common/src/webrtc/deviceHelpers'; |
@@ -73,2 +73,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
this.sessionid = response.sessid; | ||
if (response['auth-expires']) { | ||
this.authorization = { | ||
expires_at: response['auth-expires'], | ||
signature: null, | ||
project: null, | ||
scope_id: null, | ||
scopes: [], | ||
resource: null, | ||
}; | ||
this._checkTokenExpiration(); | ||
} | ||
if (!this.incognito) { | ||
@@ -75,0 +86,0 @@ localStorage.setItem(SESSION_ID, this.sessionid); |
{ | ||
"name": "@signalwire/js", | ||
"version": "1.3.0-cantina.38", | ||
"version": "1.3.0-cantina.39", | ||
"description": "Relay SDK for JavaScript to connect to SignalWire.", | ||
@@ -5,0 +5,0 @@ "author": "SignalWire Team <open.source@signalwire.com>", |
Sorry, the diff of this file is too big to display
390508
5751