Skip to content

fix(websocket): use browser-valid close codes - #65

Merged
zxch3n merged 1 commit into
loro-dev:mainfrom
peterkogo:fix-disconnect
Sep 30, 2026
Merged

zxch3n merged 1 commit into
loro-dev:mainfrom
peterkogo:fix-disconnect

Conversation

@peterkogo

@peterkogo peterkogo commented Sep 26, 2026 •

Copy link
Copy Markdown

Replace close code 1001 with 1000 in offline and heartbeat timeout handlers. Browser WebSocket.close() rejects 1001, preventing the socket from closing and blocking reconnection.

You can easily reproduce this error by turning network on & off again in Chrome devtools. The socket reconnects but never attempts to reconnect again.

Replace close code 1001 with 1000 in offline and heartbeat timeout handlers. Browser WebSocket.close() rejects 1001, preventing the socket from closing and blocking reconnection.
@zxch3n
zxch3n merged commit 1776306 into loro-dev:main Sep 30, 2026
@github-actions github-actions Bot mentioned this pull request Sep 30, 2026
robertjndw added a commit to robertjndw/typstry that referenced this pull request Oct 10, 2026
* fix: reconnect sync after the browser goes offline

loro-websocket 0.6.2 closes its socket with code 1001 on the offline event and on ping timeouts. Browsers reject that code, so the socket never closes and the client never reconnects, leaving the status stuck at Offline. Patch both calls to 1000 until the upstream fix (loro-dev/protocol#65) is released in 0.6.3.

* fix: retry loading the preview renderer after a failure

A failed renderer download (typically offline right after the page loaded) was cached, so the preview stayed broken until a reload. Drop failed loads, resync once the browser is back online instead of looping on the same failure, and start loading the renderer together with the compiler.

* test: add playwright end-to-end tests

Covers editing and compiling, autocompletion and hover docs, files and tabs, uploads and export, history, offline use, and collaboration including view-only links. Runs against the production build served by the real server, and in CI as its own job.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants