Repository navigation
fix(websocket): use browser-valid close codes - #65
Merged
Merged
Conversation
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.