feat: add Fastify, SvelteKit, and Deno hub examples - #262
Merged
Conversation
Extend the hub-*-minimal family with three more runtimes and mounting styles, each mounting the same initHub() instance: - hub-fastify-minimal: hub.nodeMiddleware via @fastify/middie, with the RPC socket riding Fastify's own node:http server through hub.attach(server) - hub-sveltekit-minimal: a catch-all +server.ts delegating to hub.handler, with a side-car socket (ws.sidecar) and trailingSlash: 'ignore' so the hub's trailing-slash URLs are served verbatim - hub-deno-minimal: Deno.serve delegating to hub.handler, with a same-origin fetch-upgrade socket Add the Deno WebSocket transport that the Deno example binds: devframe/rpc/transports/ws-deno (attachDenoWsTransport, crossws' Deno adapter), mirroring the existing ws-bun tier. Register it in the package exports, tsdown entries, alias/tsconfig paths, and knip config. Docs: add an examples page per host, and update the examples index, the sidebar, and the hub-initiate socket guide to match. Created with the help of an agent.
✅ Deploy Preview for devfra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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 & why
Following up on the new
handler/nodeMiddlewarehub API (Hono, Nitro), this extends thehub-*-minimalfamily to more runtimes and mounting styles, so the set demonstrates that oneinitHub()instance is portable across framework-neutral hosts. Each example mounts the same hub and lets@devframes/hub-uisupply the viewer.Examples added
hub-fastify-minimal— thenodeMiddlewarehost:hub.nodeMiddlewareregistered through@fastify/middie(the same(req, res, next)shape Vite's dev server consumes), with the RPC socket riding Fastify's ownnode:httpserver viahub.attach(server). No side-car port.hub-sveltekit-minimal— a catch-all+server.ts(fallback→hub.handler(event.request)), with a side-car socket (ws: { sidecar: true }) since SvelteKit handlers never see upgrades. ExportstrailingSlash = 'ignore'so the hub's trailing-slash URLs (standalone viewer + each frame SPA) are served verbatim instead of 308-redirected.hub-deno-minimal—Deno.servedelegating tohub.handler, with a same-origin fetch-upgrade socket.Core change
devframe/rpc/transports/ws-deno(attachDenoWsTransport, crossws' Deno adapter), mirroring the existingws-buntier — crossws attaches the socket to theResponseitshandleUpgradereturns, so there's no separatewebsockethandler object. Registered in the packageexports, tsdown entries,alias.ts→tsconfig.base.jsonpaths, and knip config. tsnapi API snapshot added.Docs
Added an examples page per host and updated the examples index table, the sidebar, and the
hub-initiateshared-socket guide.Notes
exact-mirror@1.2.4, which pnpm's supply-chain trust policy flags as a trust downgrade; rather than weaken the guard, it was left out.pnpm lint,pnpm knip,pnpm typecheck,pnpm test,pnpm buildall green. Fastify smoke-tested end to end (HTTP, discovery, frame SPA,embedded.js, WS RPC round-trip); SvelteKit booted and its namespace verified over HTTP. Deno typechecks/builds — its runtime isn't installed in this environment, so it wasn't run live.Created with the help of an agent.