don't detach error handler until *after* socket close

This commit is contained in:
Hazelnoot 2025-08-15 22:58:18 -04:00
parent 49eb26694a
commit d18b910791

View file

@ -311,10 +311,10 @@ export class StreamingApiServerService implements OnApplicationShutdown {
this.#connections.clear();
this.#connectionsByClient.clear();
this.#wss.off('error', this.onWsError);
await new Promise<void>((resolve, reject) => {
this.#wss.close(err => {
this.#wss.off('error', this.onWsError);
if (err) reject(err);
else resolve();
});