docs(ws): use zero-config crossws server plugin#1427
Conversation
crossws now defaults `resolve` to the app's `fetch` handler and reads the hooks attached by `defineWebSocketHandler()`, so the manual `resolve: (req) => (await app.fetch(req)).crossws` boilerplate is no longer needed. Update the WebSocket guide and example to `ws()`, document when a custom `resolve` is still useful, and drop the outdated "WIP" callout. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughDocumentation and example code for WebSocket usage with CrossWS were updated to replace explicit ChangesWebSocket Plugin Usage Simplification
Estimated code review effort: 1 (Trivial) | ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
crossws#200 makes the server plugin's
resolveoptional — it now defaults to calling the app'sfetchhandler and reading the hooks thatdefineWebSocketHandler()attaches as.crossws. That makes theresolve: (req) => (await app.fetch(req)).crosswsboilerplate in our docs redundant (it was h3 wiring itself back into itself).This PR updates the WebSocket guide + example to the zero-config form:
serve(app, { - plugins: [ws({ resolve: async (req) => (await app.fetch(req)).crossws })], + plugins: [ws()], });Docs-only — no
src/changes.serve()already passesfetch: app.fetchto srvx anddefineWebSocketHandleralready attaches.crossws, so nothing in the framework needs to change.Changes
docs/1.guide/901.advanced/2.websocket.md— usews(), update prose, add a NOTE explainingresolveis now only for custom hook resolution, and drop the outdated "WIP" callout.examples/websocket.mjs— drop theresolveargument.Follow-up (not in this PR)
crosswspeer/dev range once the release carrying crossws#200 is published (currently^0.4.8).🤖 Generated with Claude Code
Summary by CodeRabbit