livedesk 0.1.113 → 0.1.115

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.
@@ -1016,9 +1016,21 @@ class RemoteHubWebSocketAgentSocket {
1016
1016
  this.onCloseMessage = () => {};
1017
1017
  }
1018
1018
 
1019
- setNoDelay() {}
1019
+ setNoDelay(value = true) {
1020
+ try {
1021
+ this.socket?.setNoDelay?.(value);
1022
+ } catch {
1023
+ // Best-effort latency hint.
1024
+ }
1025
+ }
1020
1026
 
1021
- setKeepAlive() {}
1027
+ setKeepAlive(value = true, initialDelay = 0) {
1028
+ try {
1029
+ this.socket?.setKeepAlive?.(value, initialDelay);
1030
+ } catch {
1031
+ // Best-effort connection liveness hint.
1032
+ }
1033
+ }
1022
1034
 
1023
1035
  sendJson(payload) {
1024
1036
  return this.sendText(JSON.stringify(payload));
@@ -1670,7 +1682,7 @@ export function createRemoteHub(options = {}) {
1670
1682
  transferProtocol: descriptor.transferProtocol,
1671
1683
  transferProtocolVersion: descriptor.transferProtocolVersion,
1672
1684
  handshake: descriptor.handshake,
1673
- fps: clampNumber(options.fps, 1, 30, mode === 'thumbnail' ? 1 : 2),
1685
+ fps: clampNumber(options.fps, 1, 20, mode === 'thumbnail' ? 1 : 2),
1674
1686
  capturedAt: now,
1675
1687
  receivedAt: now,
1676
1688
  byteLength: 68,
@@ -3963,12 +3975,13 @@ export function createRemoteHub(options = {}) {
3963
3975
  }
3964
3976
 
3965
3977
  function normalizeLiveStreamStartOptions(options = {}) {
3966
- const fps = clampNumber(options.fps, 1, 30, 8);
3978
+ const transfer = buildRemoteFrameTransferDescriptor(options.mode || options.frameMode || DEFAULT_REMOTE_FRAME_MODE);
3979
+ const maxFps = transfer.frameMode === 'mode3-h264-hw' ? 20 : 30;
3980
+ const fps = clampNumber(options.fps, 1, maxFps, 8);
3967
3981
  const maxWidth = clampNumber(options.maxWidth, 320, 3840, 640);
3968
3982
  const maxHeight = clampNumber(options.maxHeight, 180, 2160, 360);
3969
3983
  const quality = clampNumber(options.quality, 20, 95, 45);
3970
3984
  const monitorIndex = normalizeMonitorIndex(options.monitorIndex ?? options.screenIndex ?? options.displayIndex);
3971
- const transfer = buildRemoteFrameTransferDescriptor(options.mode || options.frameMode || DEFAULT_REMOTE_FRAME_MODE);
3972
3985
  return { fps, maxWidth, maxHeight, quality, monitorIndex, transfer };
3973
3986
  }
3974
3987
 
package/hub/src/server.js CHANGED
@@ -177,8 +177,9 @@ function normalizeTransferFiles(value) {
177
177
 
178
178
  function normalizeLiveOptions(payload = {}) {
179
179
  const mode = String(payload.frameMode || payload.mode || 'mode3-h264-hw').trim() || 'mode3-h264-hw';
180
+ const maxFps = mode === 'mode3-h264-hw' ? 20 : 30;
180
181
  return {
181
- fps: clampNumber(payload.fps, 1, 30, 2),
182
+ fps: clampNumber(payload.fps, 1, maxFps, 2),
182
183
  maxWidth: clampNumber(payload.maxWidth, 320, 3840, 640),
183
184
  maxHeight: clampNumber(payload.maxHeight, 180, 2160, 360),
184
185
  quality: clampNumber(payload.quality, 20, 95, 45),
@@ -346,6 +347,8 @@ function buildRemoteFrameBinaryPacket(frameEvent) {
346
347
  return null;
347
348
  }
348
349
  const frame = frameEvent.frame || {};
350
+ const hubPacketEpochMs = Date.now();
351
+ const hubPacketAt = new Date(hubPacketEpochMs).toISOString();
349
352
  const metadata = {
350
353
  type: 'remote.frame.binary',
351
354
  kind: frameEvent.kind || 'live',
@@ -379,6 +382,8 @@ function buildRemoteFrameBinaryPacket(frameEvent) {
379
382
  fps: Number(frame.fps || 0) || 0,
380
383
  capturedAt: frame.capturedAt || '',
381
384
  receivedAt: frame.receivedAt || '',
385
+ hubPacketAt,
386
+ hubPacketEpochMs,
382
387
  byteLength: Number(frameEvent.byteLength || payload.length) || payload.length,
383
388
  contentHash: frame.contentHash || '',
384
389
  captureMs: Number(frame.captureMs || 0) || 0,
@@ -788,6 +793,11 @@ httpServer.on('upgrade', (req, socket, head) => {
788
793
  frameWss.on('connection', (ws, req) => {
789
794
  frameClients.add(ws);
790
795
  ws.liveDeskFrameClientId = `rfws-${++frameClientSeq}`;
796
+ try {
797
+ ws._socket?.setNoDelay?.(true);
798
+ } catch {
799
+ // Best-effort latency hint for browser frame sockets.
800
+ }
791
801
  const cleanup = () => {
792
802
  frameClients.delete(ws);
793
803
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "livedesk",
3
- "version": "0.1.113",
3
+ "version": "0.1.115",
4
4
  "description": "LiveDesk Hub and client launcher",
5
5
  "type": "module",
6
6
  "bin": {