This website requires JavaScript.
About
Status
₊˚⊹Discord
Explore
Register
Sign in
Reference in a new issue
Blame
Copy permalink
Reference in a new issue
Copy permalink
zeronsh
/
comet
Star
0
Fork
You've already forked comet
0
mirror of
https://github.com/zeronsh/comet.git
synced
2026-11-16 18:57:19 +00:00
Code
Issues
Releases
Packages
Activity
zeron/plugin-draft-replace
comet
/
edge
/
scripts
/
pullpush-check.mjs
152 lines
6.1 KiB
Raw
Permalink
Normal View
History
sync: pull-first HTTPS transport — 1-RTT bootstrap, WS demoted to enhancement The airplane-wifi fix. The WS needs 4+ serial round trips (DNS, TCP, TLS, upgrade, hello) before byte one, and hostile middleboxes strip the upgrade entirely — the user-reported 'never connects on the plane'. A plain HTTPS GET is 1 RTT on a warm connection and indistinguishable from a webpage to any proxy. So: push/pull/poke. Edge (worker + DOs): - GET /registry/{org}/rows?since= — the WS hello's exact delta answer (full/gcFloor rules shared with handleHello); ?beat=1 doubles as a presence beat. POST /registry/{org}/push — the WS push twin via a shared applyPushBatch core (validate, atomic apply, rows broadcast to live sockets); LWW clocks make replays no-ops. - GET /chat2/{id}/rows?after= — one request collapsing connect→hello→ state→rowsReq→backfill: u32-LE length-prefixed frames (state with frontier payload, rows, rowsDone), byte-identical encoding to the WS. POST /chat2/{id}/rows?batchId= — push twin, batchId-deduped. Desktop (Rust): RegistryTransport/ChatTransport seams; with a transport, construction resolves immediately (local-first), an HTTP pull bootstraps in ~1 RTT while the socket dials, and every backoff cycle pushes pending + pulls over HTTPS — a WS-hostile network degrades to ≤30s polling instead of silence. Engine wires both via the existing bearer/reqwest plumbing (registry: URL derived from the WS provider; chat: EdgeChatTransport). iOS (Swift): WorkspaceStore pull-first bootstrap + 20s poll-while-down + HTTP flush of pending writes; the header spinner now means 'server state reached this session' (flips on the ~1-RTT pull, not the 4-RTT socket). ChatRoomClient.pullSync: HTTP push of pending sends (permanent rejections retire, mirroring the error-frame path), framed rows pull applied through the exact socket path, checkpoint fetch shared via fetchInFlight. Validation: new edge/scripts/pullpush-check.mjs green against wrangler dev (push/ack/no-op replay, delta-at-cursor, presence beat, framed pull, excludeOwn, batchId dedupe); existing smoke + chat2-check (65) + reset suites green; zeron-sync 34, engine+rpc 180; iOS sim build clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-17 16:10:36 +03:00