livedesk 0.1.237 → 0.1.239

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/hub/src/server.js CHANGED
@@ -1031,7 +1031,7 @@ function unregisterFrameClient(ws) {
1031
1031
  ws.liveDeskFrameSendLane?.queue?.splice?.(0);
1032
1032
  }
1033
1033
 
1034
- function hasOtherFrameStreamOwner(ws, deviceId, streamId) {
1034
+ function hasOtherFrameStreamOwner(ws, deviceId, streamId, streamPurpose = '') {
1035
1035
  if (!streamId) {
1036
1036
  return false;
1037
1037
  }
@@ -1043,6 +1043,15 @@ function hasOtherFrameStreamOwner(ws, deviceId, streamId) {
1043
1043
  && candidate.liveDeskStreamIdsByDeviceId.get(deviceId) === streamId) {
1044
1044
  return true;
1045
1045
  }
1046
+ // A replacement frame socket can be subscribed to the same purpose before
1047
+ // startFrameSubscriptionLive records its stream id. Do not let the old
1048
+ // socket's close cleanup stop the replacement generation in that window.
1049
+ if (candidate.liveDeskAutoStart === true
1050
+ && candidate.liveDeskDeviceIds instanceof Set
1051
+ && candidate.liveDeskDeviceIds.has(deviceId)
1052
+ && String(candidate.liveDeskLiveOptions?.streamPurpose || '') === String(streamPurpose || '')) {
1053
+ return true;
1054
+ }
1046
1055
  }
1047
1056
  return false;
1048
1057
  }
@@ -1056,7 +1065,7 @@ function stopFrameClientStreams(ws) {
1056
1065
  }
1057
1066
  const streamPurpose = String(ws.liveDeskLiveOptions?.streamPurpose || 'wall');
1058
1067
  for (const [deviceId, streamId] of streams.entries()) {
1059
- if (!streamId || hasOtherFrameStreamOwner(ws, deviceId, streamId)) {
1068
+ if (!streamId || hasOtherFrameStreamOwner(ws, deviceId, streamId, streamPurpose)) {
1060
1069
  continue;
1061
1070
  }
1062
1071
  const result = remoteHub.stopLiveStream(deviceId, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "livedesk",
3
- "version": "0.1.237",
3
+ "version": "0.1.239",
4
4
  "description": "LiveDesk Hub and client launcher",
5
5
  "type": "module",
6
6
  "bin": {