Skip to content

Add node-serve setup hook#11315

Merged
mjackson merged 1 commit into
mainfrom
mjackson/node-serve-setup
Apr 30, 2026
Merged

Add node-serve setup hook#11315
mjackson merged 1 commit into
mainfrom
mjackson/node-serve-setup

Conversation

@mjackson
Copy link
Copy Markdown
Member

Adds a synchronous setup(app) option to serve() for configuring native uWebSockets.js features before node-serve registers its Fetch fallback and starts listening. Fixes #11313.

  • Passes the created uWS.TemplatedApp to setup before app.any("/*", ...), then surfaces setup errors synchronously without starting a listener.
  • Covers native WebSocket routes, connection filters, normal Fetch fallback behavior, and setup failure behavior in node-serve tests.
  • Documents WebSocket and filter usage, including uWS route pattern differences from Remix route-pattern.
serve(handler, {
  setup(app) {
    app.ws("/ws/chat", {
      open(ws) {
        ws.subscribe("chat")
      },
      message(ws, message, isBinary) {
        ws.publish("chat", message, isBinary)
      },
    })
  },
})

@github-actions
Copy link
Copy Markdown
Contributor

Preview Build Available

A preview build has been created for this PR. You can install it using:

pnpm install "remix-run/remix#preview/pr-11315&path:packages/remix"

This preview build will be updated automatically as you push new commits.

@mjackson mjackson force-pushed the mjackson/node-serve-setup branch from c26fa77 to 9fbf793 Compare April 30, 2026 22:13
@mjackson mjackson force-pushed the mjackson/node-serve-setup branch from 9fbf793 to 15c1861 Compare April 30, 2026 22:15
@mjackson mjackson merged commit ad1480f into main Apr 30, 2026
26 checks passed
@mjackson mjackson deleted the mjackson/node-serve-setup branch April 30, 2026 22:18
@github-actions
Copy link
Copy Markdown
Contributor

The preview branch preview/pr-11315 has been deleted now that this PR is merged/closed.

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.

Add a setup() hook to node-serve for WebSockets and response filters

2 participants