Move the REPL client to the native WebSocket API#79
Merged
Conversation
Replace the goog.net.WebSocket + clojure.browser.net/event transport with a thin wrapper over the platform's native WebSocket. The client now runs in any modern JS runtime (browsers, Node 22+, Deno, Bun, workers), not just the browser. Send-side handlers reply over their own socket, sends are guarded against non-open sockets, and connect! fails fast on runtimes without a WebSocket.
Compiles the client for Node and drives a real eval through a live server, asserting both the result and the print path travel back over the socket. Proves the native transport end to end (and on a non-browser runtime).
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.
First of the functionality improvements after the dep modernization. Swaps the client's transport from the legacy
goog.net.WebSocket+clojure.browser.net/eventstack to the platform's nativeWebSocket, which every modern JS runtime ships. The upshot is the client now runs outside the browser too (Node 22+, Deno, Bun, workers), which is exactly Weasel's original 'exotic JS environment' pitch.To keep this honest there's a new Node integration test: it compiles the client for Node, connects it to a real Weasel server, and asserts that both an eval result and a printed string round-trip over the socket. It runs in CI.
Heads up, two intentional breaking changes (we're pre-release at 0.8.0-SNAPSHOT): the
weasel.impls.websocketinternals changed shape, and:on-error/:on-closecallbacks now receive native WebSocket events. Both are noted in the changelog.