whio-api-sdk 1.1.11 → 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -127,9 +127,12 @@ export class WebSocketModule extends BaseClient {
|
|
|
127
127
|
* Reconnects with fresh token if current token is expired
|
|
128
128
|
*/
|
|
129
129
|
ensureValidConnection() {
|
|
130
|
-
var _a;
|
|
130
|
+
var _a, _b;
|
|
131
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
-
|
|
132
|
+
if ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.connected) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const currentToken = yield this.getValidToken();
|
|
133
136
|
// Check if we have a token and if it's expired
|
|
134
137
|
if (!currentToken || this.isTokenExpired(currentToken)) {
|
|
135
138
|
try {
|
|
@@ -144,7 +147,7 @@ export class WebSocketModule extends BaseClient {
|
|
|
144
147
|
throw new Error('Authentication failed: Unable to refresh token for WebSocket streaming');
|
|
145
148
|
}
|
|
146
149
|
}
|
|
147
|
-
else if (!((
|
|
150
|
+
else if (!((_b = this.socket) === null || _b === void 0 ? void 0 : _b.connected)) {
|
|
148
151
|
// Token is valid but not connected - establish connection
|
|
149
152
|
yield this.connect();
|
|
150
153
|
}
|
package/package.json
CHANGED
|
@@ -154,7 +154,12 @@ export class WebSocketModule extends BaseClient {
|
|
|
154
154
|
* Reconnects with fresh token if current token is expired
|
|
155
155
|
*/
|
|
156
156
|
private async ensureValidConnection(): Promise<void> {
|
|
157
|
-
|
|
157
|
+
|
|
158
|
+
if(this.socket?.connected) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const currentToken = await this.getValidToken();
|
|
158
163
|
|
|
159
164
|
// Check if we have a token and if it's expired
|
|
160
165
|
if (!currentToken || this.isTokenExpired(currentToken)) {
|