Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
The camera reaches the browser over a WebSocket, latest frame wins, so it never freezes behind Cloudflare #99
Parked 44d 15h ago
Through the relay, the camera now reaches the browser over WS /camera/ /ws, one whole picture per binary message. Cloudflare doesn't buffer or cut WebSockets, so it can no longer freeze the stream.
-
Reviews
No review yet.
-
Checks
stopped parked by the crew deploy 65a97b3
-
History
- forge.json: health is /link - the app is up when the Pi is down (its /status is 503 until the first arm status; previews could not deploy) 65a97b3
- Retrigger the deploy: the preview's /status answered 503 while the Pi was unreachable e86c7fe
- video.js: type the location default fefd95d
- The camera over a WebSocket: whole JPEGs, latest frame wins, so a proxy cannot freeze it (#87) 8f662f9
- forge.json: the app and its checks get 6 cores and 6 GiB - browser tests died at the 2-core step default (9 of 23 deploys) 8190a91
- TOP: the joint sliders follow your finger and stay where you put them - no snapping back (#79) c89e816
- /follow: size and rate checks (#78) ff3968f
- forge.json: the overhead camera on the Pi (100.89.95.68:8081) is a declared egress destination 3311805
- SAFETY P0: pressing STOP never makes the arm move - commands sent while held are dropped, never buffered and replayed (#72) 87dd4e8
- The machine, not a magic box: a Machine panel shows the raw arm state and every command in and out, live (#71) 21032a6
- Fast on a phone over 4G: first view under 2 s, the camera adapts to the connection, nothing loads until it is needed (#69) 56e9837
- Leader teleop: with the leader connected in Chrome, moving it moves the real arm - live, during your turn (#65) 896e52f
- Mobile driving: pick a joint and drag one big slider (portrait), two thumb sticks (landscape); zero motion the instant a finger lifts (#60) 058825d
- Mobile queue and turns: Join in one tap, "you're next" alert, a ring countdown on your turn, a Ready check so idle phones don't hold the arm (#57) 16caaba
- The live arm never flaps to the simulation on one slow answer: keep the connection, retry, and say "reconnecting" (#59) 5ae001d
- Terminal door: tty gating test for mute, end-turn and chat, and tty writes reaching web viewers live (#47) 3dd7ea9
- Admin: the owner is the app's admin, can name moderators, and every setting lives on one admin page (#45) 5d4fef3
- Safety first: the server enforces joint limits, speed limits, an emergency stop and a dead-man hold - no client can move the arm outside them (#31) f5d990e
- TOP: the hosted app connects to the real arm and camera - it still serves the simulation with ARM_SERVER set and both addresses granted (#43) caa4fc0
- Moderation: pause, ban and word filter (#42) 649a7c3
Through the relay, the camera now reaches the browser over WS /camera/<id>/ws, one whole picture per binary message. Cloudflare doesn't buffer or cut WebSockets, so it can no longer freeze the stream. The type check is clean and the tests I ran pass: the new camera-socket and video.js tests, plus the existing camera-feed, cameras and relay suites. I didn't run the full bun test. The forge runs the whole check on this push. Nothing was tried against a real Pi or the preview.
- Feed (
src/camera-feed.ts): a newsubscribe(listener)gives whole frames from the one shared upstream connection. A listener is never handed a frame that was already half-sent when it joined, and the offline PNG goes out at once and then on its repeat. A subscribed viewer keeps the upstream open and counts inwatching. - Socket (
src/camera-socket.ts, wired insrc/relay.ts): each viewer holds at most one waiting frame. While its socket is still sending, a newer frame replaces the waiting one, so nothing queues. The route is same-origin only and 404s for an unknown camera. I also added?fps=and a ping check, which the issue didn't ask for.?fps=keeps the quality button's saver and slow-link modes working over the socket. - Page (
src/ui/video.js): draws each message to the pane's<img>, and reconnects if nothing arrives for 2 s. The offline picture repeats every 2 s, so that reconnect can occasionally fire while the camera is down. It's harmless because the new connection gets the offline picture straight away. src/viewer.html: relayed cameras use the socket. The plain<img src=/camera/<id>/stream>path, and the freeze check on it, now only run for a local arm server. The camera code stayed inviewer.htmlapart from these hooks; I did not move the whole thing intovideo.js.- Tests (fake MJPEG source):
- A slow viewer gets far fewer frames than a fast one, and every frame it gets is whole.
- A viewer joining mid-frame gets only whole JPEGs.
- A frozen source shows the offline picture.
video.jsis tested with a fake socket, covering frame drawing, releasing old pictures and the 2 s reconnect.- Slow-viewer test: the "slow" viewer is a stub whose
sendtakes 200 ms to finish, not a real throttled socket. Bun's WebSocket client can't be made to stop reading. It proves the latest-frame-wins logic, not real network backpressure.
Through the relay, the camera now reaches the browser over
WS /camera/<id>/ws, one whole picture per binary message. Cloudflare doesn't buffer or cut WebSockets, so it can no longer freeze the stream. The type check is clean and the tests I ran pass: the new camera-socket andvideo.jstests, plus the existing camera-feed, cameras and relay suites. I didn't run the fullbun test. The forge runs the whole check on this push. Nothing was tried against a real Pi or the preview.src/camera-feed.ts): a newsubscribe(listener)gives whole frames from the one shared upstream connection. A listener is never handed a frame that was already half-sent when it joined, and the offline PNG goes out at once and then on its repeat. A subscribed viewer keeps the upstream open and counts inwatching.src/camera-socket.ts, wired insrc/relay.ts): each viewer holds at most one waiting frame. While its socket is still sending, a newer frame replaces the waiting one, so nothing queues. The route is same-origin only and 404s for an unknown camera. I also added?fps=and a ping check, which the issue didn't ask for.?fps=keeps the quality button's saver and slow-link modes working over the socket.src/ui/video.js): draws each message to the pane's<img>, and reconnects if nothing arrives for 2 s. The offline picture repeats every 2 s, so that reconnect can occasionally fire while the camera is down. It's harmless because the new connection gets the offline picture straight away.src/viewer.html: relayed cameras use the socket. The plain<img src=/camera/<id>/stream>path, and the freeze check on it, now only run for a local arm server. The camera code stayed inviewer.htmlapart from these hooks; I did not move the whole thing intovideo.js.video.jsis tested with a fake socket, covering frame drawing, releasing old pictures and the 2 s reconnect.sendtakes 200 ms to finish, not a real throttled socket. Bun's WebSocket client can't be made to stop reading. It proves the latest-frame-wins logic, not real network backpressure.Closes #87