Repository navigation
Major Changes
-
e29605d: Require Next.js 15.0.0 or later, Node.js 20.9 or later and ws 8 or later, remove the deprecated
SOCKEThandler andnext-ws/cliententry, and ship an ESM build alongside CommonJS.Replace the adapter's automatic relaying with rooms. Clients join rooms with
join(), andbroadcast()sends to a room on every instance through the adapter, which now only carries what is broadcast.getClients()lists a room's local clients.context.paramsinUPGRADEis now a promise, like in route handlers, so Next.js's ownRouteContexttype fits it. Its values can still be read without awaiting.headers()andcookies()resolve to a promise insideUPGRADE, as they do everywhere else in Next.js.
Minor Changes
- 9ef5f30: Install with no dependencies, as the CLI bundles what it needs in place of jscodeshift. Patching now fails with a clear error when Next.js has changed, rather than appearing to succeed, writes nothing unless every step applies, cleanly replaces patches made by next-ws 2, and supports every Next.js 15 and 16 release without a next-ws update
- 9ef5f30: Hold messages a client sends before
UPGRADElistens for them, read the adapter and WebSocket server when they are first needed soinstrumentation.tscan set them, wait for Next.js to finish starting before handling upgrades, leave unmatched upgrades to a custom server's own listeners, abortrequest.signalwhen the connection closes, match routes the way Next.js does (including parameter names such as[post-id]) and cache them in production
Patch Changes
- e29605d: Fix
-yand-eCLI flags, reject unmatched upgrades with an HTTP status, keepheaders()andcookies()working inside socket event listeners, decode route params, match root routes, and stop malformed requests from crashing the server