svelte-adapter-uws-extensions 0.1.7 → 0.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-adapter-uws-extensions",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Redis and Postgres extensions for svelte-adapter-uws - distributed pub/sub, replay buffers, presence tracking, rate limiting, groups, and DB change notifications",
5
5
  "author": "Kevin Radziszewski",
6
6
  "license": "MIT",
package/redis/presence.js CHANGED
@@ -304,6 +304,15 @@ export function createPresence(client, options = {}) {
304
304
  redis.eval(CLEANUP_SCRIPT, 1, hashKey(topic), now, presenceTtlMs).catch((err) => {
305
305
  console.warn('presence heartbeat: stale cleanup failed for topic "' + topic + '":', err.message);
306
306
  });
307
+
308
+ // Publish heartbeat event so the adapter core client can
309
+ // refresh maxAge timestamps for active users. Without this,
310
+ // client-side maxAge evicts live users that have not had a
311
+ // fresh join/list event within the window.
312
+ if (activePlatform && data && data.size > 0) {
313
+ const keys = [...data.keys()];
314
+ activePlatform.publish('__presence:' + topic, 'heartbeat', keys);
315
+ }
307
316
  }
308
317
  }, heartbeatInterval);
309
318
  if (heartbeatTimer.unref) heartbeatTimer.unref();