@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.js CHANGED
@@ -12979,6 +12979,13 @@ function createApiDeps(deps) {
12979
12979
  );
12980
12980
  }
12981
12981
  }
12982
+ if (msg.type === "unsubscribe_session" && typeof msg.sessionId === "string") {
12983
+ if (!wsAllows(principal, "history:read")) {
12984
+ deny(msg.type, "history:read");
12985
+ return;
12986
+ }
12987
+ deps.removeSessionSubscriber(msg.sessionId, ws);
12988
+ }
12982
12989
  if (msg.type === "hold_session" && typeof msg.sessionId === "string") {
12983
12990
  if (!wsAllows(principal, "session:control")) {
12984
12991
  deny(msg.type, "session:control");
@@ -16164,6 +16171,7 @@ var StreamerServer = class {
16164
16171
  withReconciledLifecycle: (sessions) => this.withReconciledLifecycle(sessions),
16165
16172
  currentWarmupState: () => this.currentWarmupState(),
16166
16173
  addSessionSubscriber: (sessionId, ws) => this.addSessionSubscriber(sessionId, ws),
16174
+ removeSessionSubscriber: (sessionId, ws) => this.removeSessionSubscriber(sessionId, ws),
16167
16175
  startGraceTimer: (sessionId, delayMs) => this.startGraceTimer(sessionId, delayMs),
16168
16176
  armHoldWhenIdle: (sessionId) => this.armHoldWhenIdle(sessionId),
16169
16177
  handleSessionsCount: (res) => this.handleSessionsCount(res),
@@ -16293,6 +16301,12 @@ var StreamerServer = class {
16293
16301
  );
16294
16302
  }
16295
16303
  }
16304
+ removeSessionSubscriber(sessionId, ws) {
16305
+ const subs = this.sessionSubscribers.get(sessionId);
16306
+ if (!subs) return;
16307
+ subs.delete(ws);
16308
+ if (subs.size === 0) this.sessionSubscribers.delete(sessionId);
16309
+ }
16296
16310
  /**
16297
16311
  * Bring up Live Activity push, if credentials are present (Feature 12).
16298
16312
  *