fix(devframe): bind a runtime-appropriate RPC WebSocket transport on Bun/Deno - #322
Merged
Conversation
…Bun/Deno The instance shell always loaded crossws's Node adapter, which refuses to run off Node, so the WebSocket RPC transport crashed on Bun and Deno (e.g. a hub mounted in Vite DevTools under `bunx --bun`). Pick the binding by runtime instead: a side-car (where devframe owns a dedicated server) now binds crossws's Bun/Deno adapter over Bun.serve / Deno.serve for a real native WebSocket, and a shared foreign node:http server (which can't be re-hosted natively) falls back to the runtime- agnostic SSE transport. attach / handleUpgrade and a transportless shared server surface clear diagnostics (DF0076 / DF0075) instead of the opaque crossws error. Adds a cross-runtime RPC transport smoke test run under Bun and Deno in CI (and Node locally) to guard the binding. Closes #317
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
What
Fixes #317.
instance-shellalways loaded crossws's Node adapter, which refuses to run off Node, so the WebSocket RPC transport crashed on Bun and Deno — reproduced through@vitejs/devtoolsunderbunx --bun vite-devtools.How
The RPC socket binding is now chosen by runtime:
Bun.serve/Deno.servefor a real native WebSocket, keeping crossws's Node adapter on Node.node:httpserver handed in — the Vite DevTools case): a foreign Node server can't be re-hosted natively, so on Bun/Deno it falls back to the runtime-agnostic SSE transport (already shipped), advertised asbackend: 'sse'. On Node it is unchanged (native WebSocket).attach/handleUpgrade(rawnode:httpupgrade) and a transportless shared server now raise clear diagnostics (DF0076 / DF0075) on Bun/Deno instead of the opaque crossws error.The
unboundtier is unchanged, so the existinghub-deno-minimalpattern (host wires its own native transport) keeps working.Tests
Adds a cross-runtime RPC transport smoke test (
packages/devframe/test/runtime-smoke.ts) that boots realinitDevframeinstances and drives one RPC round-trip through each binding — the native WebSocket side-car and the shared-server transport — under Node, Bun, and Deno. New CIruntimematrix job runs it on Bun and Deno;test:runtime/test:runtime:bun/test:runtime:denoscripts run it locally. Verified passing on Node, Bun 1.3, and Deno 2.This PR was created with the help of an agent.