Repository navigation
Add framework recipes for the Next.js, Astro, Remix, Hono and Tornado examples - #127
Merged
Merged
Conversation
… examples One recipe per example, in plain and friendly language: where the shared client goes, how to use it in that framework's components, where the WebSocket server goes, the framework's catches, production, and things to try in the running example. - Next.js: a client from react-websocket/core, hooks in Client Components, Suspense with browser(), and a custom server for upgrades - Astro: islands sharing one client, a store for islands that hydrate late, client:only Suspense, ClientRouter with transition:persist, a custom element without React, and the server in dev and production - Remix 3: react-websocket/core with bindings that stand in for the hooks, client entries, the asset server's allow list, and upgrades on the Node server - Hono: shared message types, upgradeWebSocket on Node.js, the Vite proxy, room state refreshed by welcome, and one port in production - Tornado: the broadcast handler, check_origin, server pings, the message size limit, running with uv, and a client heartbeat The recipes page gets a Frameworks section and the sidebar a Frameworks group. The home page, Getting started, the SSR and Without React guides and each example's README link to them. Code blocks are copied or trimmed from the examples and type-checked against the library (tsc, and astro check for .astro files). The Tornado heartbeat is the one new piece of code: it was run against a copy of the example's server, which answered the pings, and a paused server was noticed within the timeout.
Merged
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.
Five new recipes under Recipes, one for each runnable example that didn't have a docs page yet: Next.js, Astro, Remix 3, Hono and Tornado (Python). The game example already has one (Real-time action game). No library code changes (
src/is untouched).What each page covers
Each page is written in plain, friendly language and has the same shape: the short version in a few bullets, install, where the shared client goes, how to use it in that framework's components, where the WebSocket server goes, the framework's catches, production, and things to try in the running example.
nextjs.mdreact-websocket/corethat Server Components can import, hooks in Client Components, Suspense withbrowser(), and a custom server because route handlers can't accept upgradesastro.mdclient:onlyisland,<ClientRouter />withtransition:persist, a custom element without React, and the server in dev (integration hook) and production (Express)remix.mdreact-websocket/corewith the example's bindings standing in for the hooks, client entries, the asset server's allow list, and upgrades on the Node serverhono.mdupgradeWebSocketon Node.js, the Vite/wsproxy, room state refreshed bywelcome, and one port in productiontornado.mdcheck_origin, server pings, the message size limit, running with uv, and a client heartbeatOther changes
docs/recipes.md: a Frameworks section with cards, above the real-world guides.rspress.config.ts: a Frameworks sidebar group.[Unreleased]in the changelog.Verified
tsc, andastro checkfor the.astrofiles: 0 errors).4000within the timeout and reconnected after the resume. Without the server'sreturn, every client reports aMessageError, as the page warns.npm run docs:buildandnpm run checkpass, and all 128 relative links and anchors in the new and edited pages resolve.