Skip to content

Move the REPL client to the native WebSocket API#79

Merged
bbatsov merged 3 commits into
masterfrom
native-websocket-transport
Jun 27, 2026
Merged

Move the REPL client to the native WebSocket API#79
bbatsov merged 3 commits into
masterfrom
native-websocket-transport

Conversation

@bbatsov

@bbatsov bbatsov commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

First of the functionality improvements after the dep modernization. Swaps the client's transport from the legacy goog.net.WebSocket + clojure.browser.net/event stack to the platform's native WebSocket, 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.websocket internals changed shape, and :on-error/:on-close callbacks now receive native WebSocket events. Both are noted in the changelog.

bbatsov added 3 commits June 27, 2026 10:22
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).
@bbatsov bbatsov merged commit 2185e57 into master Jun 27, 2026
1 check passed
@bbatsov bbatsov deleted the native-websocket-transport branch June 27, 2026 08:19
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.

1 participant