livedesk 0.1.247 → 0.1.248

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
@@ -38,8 +38,9 @@ const webIndexPath = resolve(webDistPath, 'index.html');
38
38
  const packageInfo = JSON.parse(readFileSync(resolve(__dirname, '..', 'package.json'), 'utf8'));
39
39
  const httpHost = process.env.LIVEDESK_HUB_HTTP_HOST || '127.0.0.1';
40
40
  const httpPort = Number(process.env.LIVEDESK_HUB_HTTP_PORT || process.env.PORT || 5179);
41
- const frameBackpressureBytes = readPositiveIntegerEnv('LIVEDESK_FRAME_WS_BACKPRESSURE_BYTES', 64 * 1024 * 1024);
42
- const frameClientQueuePackets = readPositiveIntegerEnv('LIVEDESK_FRAME_WS_QUEUE_PACKETS', 256);
41
+ const frameBackpressureBytes = readPositiveIntegerEnv('LIVEDESK_FRAME_WS_BACKPRESSURE_BYTES', 64 * 1024 * 1024);
42
+ const frameClientQueuePackets = readPositiveIntegerEnv('LIVEDESK_FRAME_WS_QUEUE_PACKETS', 256);
43
+ const controlFrameClientQueuePackets = readPositiveIntegerEnv('LIVEDESK_CONTROL_FRAME_WS_QUEUE_PACKETS', 4);
43
44
  const frameClientDrainBudgetPackets = readPositiveIntegerEnv('LIVEDESK_FRAME_WS_DRAIN_BUDGET_PACKETS', 64);
44
45
  const frameStreamStopGraceMs = readPositiveIntegerEnv('LIVEDESK_FRAME_STREAM_STOP_GRACE_MS', 1500);
45
46
  const mode5FrameBackpressureBytes = readPositiveIntegerEnv('LIVEDESK_MODE5_WS_BACKPRESSURE_BYTES', 2 * 1024 * 1024);
@@ -1128,7 +1129,7 @@ function registerFrameClient(ws) {
1128
1129
  }
1129
1130
  }
1130
1131
 
1131
- function ensureFrameClientSendLane(ws) {
1132
+ function ensureFrameClientSendLane(ws) {
1132
1133
  if (!ws.liveDeskFrameSendLane) {
1133
1134
  ws.liveDeskFrameSendLane = {
1134
1135
  queue: [],
@@ -1137,8 +1138,14 @@ function ensureFrameClientSendLane(ws) {
1137
1138
  awaitingKeyFrames: new Set()
1138
1139
  };
1139
1140
  }
1140
- return ws.liveDeskFrameSendLane;
1141
- }
1141
+ return ws.liveDeskFrameSendLane;
1142
+ }
1143
+
1144
+ function frameClientQueueLimit(ws) {
1145
+ return ws?.liveDeskLiveOptions?.streamPurpose === 'control'
1146
+ ? controlFrameClientQueuePackets
1147
+ : frameClientQueuePackets;
1148
+ }
1142
1149
 
1143
1150
  function dropQueuedFrameForLane(lane) {
1144
1151
  const deltaIndex = lane.queue.findIndex(item => item?.isKeyFrame !== true);
@@ -1243,7 +1250,7 @@ function enqueueFramePacketForClient(ws, packet, meta) {
1243
1250
  ws.liveDeskFrameBackpressureDrops = Number(ws.liveDeskFrameBackpressureDrops || 0) + 1;
1244
1251
  }
1245
1252
  }
1246
- while (lane.queue.length >= frameClientQueuePackets) {
1253
+ while (lane.queue.length >= frameClientQueueLimit(ws)) {
1247
1254
  dropQueuedFrameForLane(lane);
1248
1255
  ws.liveDeskFrameBackpressureDrops = Number(ws.liveDeskFrameBackpressureDrops || 0) + 1;
1249
1256
  }
@@ -2866,9 +2873,14 @@ audioWss.on('connection', (ws, req) => {
2866
2873
  });
2867
2874
  });
2868
2875
 
2869
- inputWss.on('connection', ws => {
2870
- inputClients.add(ws);
2871
- ws.liveDeskInputClientId = `riws-${++inputClientSeq}`;
2876
+ inputWss.on('connection', ws => {
2877
+ inputClients.add(ws);
2878
+ ws.liveDeskInputClientId = `riws-${++inputClientSeq}`;
2879
+ try {
2880
+ ws._socket?.setNoDelay?.(true);
2881
+ } catch {
2882
+ // Best-effort latency hint for browser input sockets.
2883
+ }
2872
2884
  ws.on('message', data => {
2873
2885
  let payload;
2874
2886
  try {
@@ -2882,8 +2894,10 @@ inputWss.on('connection', ws => {
2882
2894
  ? { ...payload.input, hubReceivedAtEpochMs: Date.now() }
2883
2895
  : { ...payload, hubReceivedAtEpochMs: Date.now() };
2884
2896
  const result = remoteHub.sendInputControl(deviceId, input);
2885
- const fireAndForget = payload?.fireAndForget === true
2886
- || String(input?.type || '').toLowerCase() === 'pointermove';
2897
+ const inputType = String(input?.type || '').toLowerCase();
2898
+ const fireAndForget = payload?.fireAndForget === true
2899
+ || inputType === 'pointermove'
2900
+ || inputType === 'wheel';
2887
2901
  if (fireAndForget && result?.ok) {
2888
2902
  return;
2889
2903
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "livedesk",
3
- "version": "0.1.247",
3
+ "version": "0.1.248",
4
4
  "description": "LiveDesk Hub and client launcher",
5
5
  "type": "module",
6
6
  "bin": {