SIGN IN SIGN UP
nestjs / nest UNCLAIMED

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀

0 0 134 TypeScript

feat(core): warn on late websocket adapter registration

Calling app.useWebSocketAdapter(adapter) after app.init() has run (e.g.
from any module's OnModuleInit hook) silently no-ops: the websockets
module has already captured the adapter from ApplicationConfig and
bootstrapped the gateways. The provided adapter is stored on the config
but never applied — gateways remain bound to whatever adapter was active
during init(), which in practice is the default IoAdapter.

Track this with an isWsModuleRegistered flag flipped after
socketModule.register() succeeds, and emit a Logger.warn from
useWebSocketAdapter() when called too late. The adapter is still set on
ApplicationConfig so any code path that inspects it post-hoc keeps the
existing behaviour — the warning only surfaces the timing mismatch so
consumers can move the call to main.ts before app.init() / app.listen().

Closes #16992
H
hbinhng committed
d956db4c104c22172c3466344b50c017267aca23
Parent: 801c46f