MCPcopy
hub / github.com/CapSoftware/Cap / startSocket

Function startSocket

apps/desktop/src/routes/camera.tsx:586–605  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

584 };
585
586 const startSocket = () => {
587 if (ws || !isWindowVisible()) return;
588
589 retryCount = 0;
590 lastFrameTime = Date.now();
591 ws = createSocket();
592
593 stallCheckInterval = setInterval(() => {
594 if (
595 ws?.readyState === WebSocket.OPEN &&
596 isWindowVisible() &&
597 lastFrameTime > 0 &&
598 Date.now() - lastFrameTime > STALL_TIMEOUT_MS
599 ) {
600 lastFrameTime = Date.now();
601 commands.refreshCameraFeed().catch(() => {});
602 ws.close();
603 }
604 }, STALL_TIMEOUT_MS);
605 };
606
607 createEffect(() => {
608 if (isWindowVisible()) {

Callers 1

LegacyCameraPreviewPageFunction · 0.85

Calls 1

createSocketFunction · 0.70

Tested by

no test coverage detected