@pooflabs/core 0.0.35 → 0.0.36
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.
- package/dist/index.js +0 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4218,8 +4218,6 @@ async function getOrCreateConnection(appId, isServer) {
|
|
|
4218
4218
|
isConnected: false,
|
|
4219
4219
|
appId,
|
|
4220
4220
|
tokenRefreshTimer: null,
|
|
4221
|
-
lastMessageAt: Date.now(),
|
|
4222
|
-
keepaliveTimer: null,
|
|
4223
4221
|
consecutiveAuthFailures: 0,
|
|
4224
4222
|
};
|
|
4225
4223
|
connections.set(appId, connection);
|
|
@@ -4271,7 +4269,6 @@ async function getOrCreateConnection(appId, isServer) {
|
|
|
4271
4269
|
ws.addEventListener('open', () => {
|
|
4272
4270
|
connection.isConnecting = false;
|
|
4273
4271
|
connection.isConnected = true;
|
|
4274
|
-
connection.lastMessageAt = Date.now();
|
|
4275
4272
|
connection.consecutiveAuthFailures = 0;
|
|
4276
4273
|
// Schedule periodic token freshness checks
|
|
4277
4274
|
scheduleTokenRefresh(connection, isServer);
|
|
@@ -4280,25 +4277,9 @@ async function getOrCreateConnection(appId, isServer) {
|
|
|
4280
4277
|
sub.lastData = undefined;
|
|
4281
4278
|
sendSubscribe(connection, sub);
|
|
4282
4279
|
}
|
|
4283
|
-
// Start keepalive detection — if no messages for 90s, force reconnect
|
|
4284
|
-
if (connection.keepaliveTimer) {
|
|
4285
|
-
clearInterval(connection.keepaliveTimer);
|
|
4286
|
-
}
|
|
4287
|
-
connection.keepaliveTimer = setInterval(() => {
|
|
4288
|
-
var _a;
|
|
4289
|
-
if (Date.now() - connection.lastMessageAt > 90000) {
|
|
4290
|
-
console.warn('[WS v2] No messages received for 90s, forcing reconnect');
|
|
4291
|
-
if (connection.keepaliveTimer) {
|
|
4292
|
-
clearInterval(connection.keepaliveTimer);
|
|
4293
|
-
connection.keepaliveTimer = null;
|
|
4294
|
-
}
|
|
4295
|
-
(_a = connection.ws) === null || _a === void 0 ? void 0 : _a.reconnect();
|
|
4296
|
-
}
|
|
4297
|
-
}, 30000);
|
|
4298
4280
|
});
|
|
4299
4281
|
// Handle incoming messages
|
|
4300
4282
|
ws.addEventListener('message', (event) => {
|
|
4301
|
-
connection.lastMessageAt = Date.now();
|
|
4302
4283
|
try {
|
|
4303
4284
|
const message = JSON.parse(event.data);
|
|
4304
4285
|
handleServerMessage(connection, message);
|
|
@@ -4322,10 +4303,6 @@ async function getOrCreateConnection(appId, isServer) {
|
|
|
4322
4303
|
clearInterval(connection.tokenRefreshTimer);
|
|
4323
4304
|
connection.tokenRefreshTimer = null;
|
|
4324
4305
|
}
|
|
4325
|
-
if (connection.keepaliveTimer) {
|
|
4326
|
-
clearInterval(connection.keepaliveTimer);
|
|
4327
|
-
connection.keepaliveTimer = null;
|
|
4328
|
-
}
|
|
4329
4306
|
});
|
|
4330
4307
|
return connection;
|
|
4331
4308
|
}
|
|
@@ -4583,10 +4560,6 @@ async function closeAllSubscriptionsV2() {
|
|
|
4583
4560
|
clearInterval(connection.tokenRefreshTimer);
|
|
4584
4561
|
connection.tokenRefreshTimer = null;
|
|
4585
4562
|
}
|
|
4586
|
-
if (connection.keepaliveTimer) {
|
|
4587
|
-
clearInterval(connection.keepaliveTimer);
|
|
4588
|
-
connection.keepaliveTimer = null;
|
|
4589
|
-
}
|
|
4590
4563
|
if (connection.ws) {
|
|
4591
4564
|
const ws = connection.ws;
|
|
4592
4565
|
connection.ws = null;
|