@threadbase-sh/streamer 1.66.0 → 1.67.0

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.cjs CHANGED
@@ -13008,6 +13008,13 @@ function createApiDeps(deps) {
13008
13008
  );
13009
13009
  }
13010
13010
  }
13011
+ if (msg.type === "unsubscribe_session" && typeof msg.sessionId === "string") {
13012
+ if (!wsAllows(principal, "history:read")) {
13013
+ deny(msg.type, "history:read");
13014
+ return;
13015
+ }
13016
+ deps.removeSessionSubscriber(msg.sessionId, ws);
13017
+ }
13011
13018
  if (msg.type === "hold_session" && typeof msg.sessionId === "string") {
13012
13019
  if (!wsAllows(principal, "session:control")) {
13013
13020
  deny(msg.type, "session:control");
@@ -16193,6 +16200,7 @@ var StreamerServer = class {
16193
16200
  withReconciledLifecycle: (sessions) => this.withReconciledLifecycle(sessions),
16194
16201
  currentWarmupState: () => this.currentWarmupState(),
16195
16202
  addSessionSubscriber: (sessionId, ws) => this.addSessionSubscriber(sessionId, ws),
16203
+ removeSessionSubscriber: (sessionId, ws) => this.removeSessionSubscriber(sessionId, ws),
16196
16204
  startGraceTimer: (sessionId, delayMs) => this.startGraceTimer(sessionId, delayMs),
16197
16205
  armHoldWhenIdle: (sessionId) => this.armHoldWhenIdle(sessionId),
16198
16206
  handleSessionsCount: (res) => this.handleSessionsCount(res),
@@ -16322,6 +16330,12 @@ var StreamerServer = class {
16322
16330
  );
16323
16331
  }
16324
16332
  }
16333
+ removeSessionSubscriber(sessionId, ws) {
16334
+ const subs = this.sessionSubscribers.get(sessionId);
16335
+ if (!subs) return;
16336
+ subs.delete(ws);
16337
+ if (subs.size === 0) this.sessionSubscribers.delete(sessionId);
16338
+ }
16325
16339
  /**
16326
16340
  * Bring up Live Activity push, if credentials are present (Feature 12).
16327
16341
  *