@fluojs/websockets 1.0.0-beta.3 → 1.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.ko.md CHANGED
@@ -65,8 +65,8 @@ class MetricsGateway {
65
65
  }
66
66
  ```
67
67
 
68
- ### Server-Backed (Node.js 전용)
69
- Node 기반 어댑터(Express/Fastify) 경우 전용 리스너 포트를 사용하도록 설정할 수 있습니다.
68
+ ### Server-Backed Node adapter
69
+ Server-backed Node adapter(Node.js, Express, Fastify)에서는 전용 listener port를 사용할 수 있습니다. Fetch-style runtime(`@fluojs/websockets/bun`, `@fluojs/websockets/deno`, `@fluojs/websockets/cloudflare-workers`)은 `serverBacked`를 거부합니다.
70
70
 
71
71
  ```typescript
72
72
  @WebSocketGateway({
@@ -101,7 +101,7 @@ WebSocketModule.forRoot({
101
101
  });
102
102
  ```
103
103
 
104
- 옵션을 생략하면 `@fluojs/websockets`는 동시 연결 수와 인바운드 페이로드 크기에 대해 기본 제한값을 적용합니다. 또한 server-backed Node 리스너는 `heartbeat.enabled`를 명시적으로 `false`로 두지 않는 한 heartbeat 타이머를 활성화합니다.
104
+ 옵션을 생략하면 `@fluojs/websockets`는 동시 연결 수, inbound payload 크기, pending message buffer, shutdown cleanup에 bounded default를 적용합니다. 기본값은 `maxConnections: 1000`, `maxPayloadBytes: 1 MiB`, `buffer.maxPendingMessagesPerSocket: 256`, `shutdown.timeoutMs: 5000`, Node heartbeat interval `30s`, Node backpressure `maxBufferedAmountBytes: 1 MiB`와 drop behavior입니다. 또한 server-backed Node listener는 `heartbeat.enabled`를 명시적으로 `false`로 두지 않는 한 heartbeat timer를 활성화합니다. 공식 fetch-style runtime module(`@fluojs/websockets/bun`, `@fluojs/websockets/deno`, `@fluojs/websockets/cloudflare-workers`)은 애플리케이션 shutdown 시 추적 중인 websocket 클라이언트를 닫고 `shutdown.timeoutMs` 범위 안에서 `@OnDisconnect()` cleanup이 마무리될 수 있도록 bounded 기회를 제공합니다.
105
105
 
106
106
  ## 공개 API 개요
107
107
 
@@ -110,20 +110,20 @@ WebSocketModule.forRoot({
110
110
  - `@OnMessage(event?)`: 인바운드 메시지 핸들러를 위한 데코레이터입니다.
111
111
  - `@OnDisconnect()`: 연결 해제 핸들러를 위한 데코레이터입니다.
112
112
  - `WebSocketModule`: WebSocket 통합을 위한 루트 모듈입니다.
113
- - `WebSocketModule.forRoot({ upgrade, limits, heartbeat, ... })`: pre-upgrade guard와 기본 제한값을 구성합니다.
113
+ - `WebSocketModule.forRoot({ upgrade, limits, backpressure, buffer, heartbeat, shutdown })`: pre-upgrade guard와 bounded runtime default를 구성합니다.
114
114
  - `WebSocketGatewayLifecycleService`: 기본 Node.js 기반 lifecycle service token을 위한 루트 alias입니다.
115
- - `WebSocketModule.forRoot(...)`: 기본 루트 WebSocket 모듈의 패키지 수준 등록을 구성합니다.
115
+ - Metadata helper와 symbol: `defineWebSocketGatewayMetadata`, `getWebSocketGatewayMetadata`, `defineWebSocketHandlerMetadata`, `getWebSocketHandlerMetadata`, `getWebSocketHandlerMetadataEntries`, `webSocketGatewayMetadataSymbol`, `webSocketHandlerMetadataSymbol`.
116
116
 
117
117
  ## 런타임별 서브패스
118
118
 
119
119
  기본 루트 Node.js alias 대신 런타임을 명시적으로 고정하고 싶다면 런타임별 서브패스를 사용하세요. 각 서브패스는 해당 `*WebSocketModule.forRoot(...)` 진입점과 일치하는 런타임 lifecycle service export를 제공합니다.
120
120
 
121
- | 런타임 | 서브패스 | 모듈 |
122
- | --- | --- | --- |
123
- | Node.js | `@fluojs/websockets/node` | `NodeWebSocketModule` |
124
- | Bun | `@fluojs/websockets/bun` | `BunWebSocketModule` |
125
- | Deno | `@fluojs/websockets/deno` | `DenoWebSocketModule` |
126
- | Workers | `@fluojs/websockets/cloudflare-workers` | `CloudflareWorkersWebSocketModule` |
121
+ | 런타임 | 서브패스 | 모듈 | Lifecycle service |
122
+ | --- | --- | --- | --- |
123
+ | Node.js | `@fluojs/websockets/node` | `NodeWebSocketModule` | `NodeWebSocketGatewayLifecycleService` |
124
+ | Bun | `@fluojs/websockets/bun` | `BunWebSocketModule` | `BunWebSocketGatewayLifecycleService` |
125
+ | Deno | `@fluojs/websockets/deno` | `DenoWebSocketModule` | `DenoWebSocketGatewayLifecycleService` |
126
+ | Workers | `@fluojs/websockets/cloudflare-workers` | `CloudflareWorkersWebSocketModule` | `CloudflareWorkersWebSocketGatewayLifecycleService` |
127
127
 
128
128
  ## 예제 소스
129
129
 
@@ -131,3 +131,5 @@ WebSocketModule.forRoot({
131
131
  - `packages/websockets/src/public-surface.test.ts`
132
132
  - `packages/websockets/src/node/node.test.ts`
133
133
  - `packages/websockets/src/bun/bun.test.ts`
134
+ - `packages/websockets/src/deno/deno.test.ts`
135
+ - `packages/websockets/src/cloudflare-workers/cloudflare-workers.test.ts`
package/README.md CHANGED
@@ -65,8 +65,8 @@ class MetricsGateway {
65
65
  }
66
66
  ```
67
67
 
68
- ### Server-Backed (Node.js Only)
69
- For Node-based adapters (Express/Fastify), you can opt into a dedicated listener port.
68
+ ### Server-Backed Node Adapters
69
+ For server-backed Node adapters (Node.js, Express, Fastify), you can opt into a dedicated listener port. Fetch-style runtimes (`@fluojs/websockets/bun`, `@fluojs/websockets/deno`, and `@fluojs/websockets/cloudflare-workers`) reject `serverBacked`.
70
70
 
71
71
  ```typescript
72
72
  @WebSocketGateway({
@@ -101,7 +101,7 @@ WebSocketModule.forRoot({
101
101
  });
102
102
  ```
103
103
 
104
- When omitted, `@fluojs/websockets` now applies bounded defaults for concurrent connections and inbound payload size. Server-backed Node listeners also enable heartbeat timers unless you explicitly set `heartbeat.enabled` to `false`.
104
+ When omitted, `@fluojs/websockets` applies bounded defaults for concurrent connections, inbound payload size, pending message buffers, and shutdown cleanup. Default settings are `maxConnections: 1000`, `maxPayloadBytes: 1 MiB`, `buffer.maxPendingMessagesPerSocket: 256`, `shutdown.timeoutMs: 5000`, Node heartbeat interval `30s`, and Node backpressure `maxBufferedAmountBytes: 1 MiB` with drop behavior. Server-backed Node listeners enable heartbeat timers unless you explicitly set `heartbeat.enabled` to `false`. The official fetch-style runtime modules (`@fluojs/websockets/bun`, `@fluojs/websockets/deno`, and `@fluojs/websockets/cloudflare-workers`) close tracked websocket clients during application shutdown and give `@OnDisconnect()` cleanup a bounded chance to finish within `shutdown.timeoutMs`.
105
105
 
106
106
  ## Public API Overview
107
107
 
@@ -110,20 +110,20 @@ When omitted, `@fluojs/websockets` now applies bounded defaults for concurrent c
110
110
  - `@OnMessage(event?)`: Decorator for inbound message handlers.
111
111
  - `@OnDisconnect()`: Decorator for disconnection handlers.
112
112
  - `WebSocketModule`: Root module for WebSocket integration.
113
- - `WebSocketModule.forRoot({ upgrade, limits, heartbeat, ... })`: Configures pre-upgrade guards and bounded runtime defaults.
113
+ - `WebSocketModule.forRoot({ upgrade, limits, backpressure, buffer, heartbeat, shutdown })`: Configures pre-upgrade guards and bounded runtime defaults.
114
114
  - `WebSocketGatewayLifecycleService`: Root alias for the default Node.js-backed lifecycle service token.
115
- - `WebSocketModule.forRoot(...)`: Configures package-level registration for the default root websocket module.
115
+ - Metadata helpers and symbols: `defineWebSocketGatewayMetadata`, `getWebSocketGatewayMetadata`, `defineWebSocketHandlerMetadata`, `getWebSocketHandlerMetadata`, `getWebSocketHandlerMetadataEntries`, `webSocketGatewayMetadataSymbol`, `webSocketHandlerMetadataSymbol`.
116
116
 
117
117
  ## Runtime-Specific Subpaths
118
118
 
119
119
  Use the runtime subpaths when you want an explicit runtime binding instead of the default root Node.js alias. Each subpath exposes its `*WebSocketModule.forRoot(...)` entrypoint plus the matching runtime lifecycle service export.
120
120
 
121
- | Runtime | Subpath | Module |
122
- | --- | --- | --- |
123
- | Node.js | `@fluojs/websockets/node` | `NodeWebSocketModule` |
124
- | Bun | `@fluojs/websockets/bun` | `BunWebSocketModule` |
125
- | Deno | `@fluojs/websockets/deno` | `DenoWebSocketModule` |
126
- | Workers | `@fluojs/websockets/cloudflare-workers` | `CloudflareWorkersWebSocketModule` |
121
+ | Runtime | Subpath | Module | Lifecycle service |
122
+ | --- | --- | --- | --- |
123
+ | Node.js | `@fluojs/websockets/node` | `NodeWebSocketModule` | `NodeWebSocketGatewayLifecycleService` |
124
+ | Bun | `@fluojs/websockets/bun` | `BunWebSocketModule` | `BunWebSocketGatewayLifecycleService` |
125
+ | Deno | `@fluojs/websockets/deno` | `DenoWebSocketModule` | `DenoWebSocketGatewayLifecycleService` |
126
+ | Workers | `@fluojs/websockets/cloudflare-workers` | `CloudflareWorkersWebSocketModule` | `CloudflareWorkersWebSocketGatewayLifecycleService` |
127
127
 
128
128
  ## Example Sources
129
129
 
@@ -131,3 +131,5 @@ Use the runtime subpaths when you want an explicit runtime binding instead of th
131
131
  - `packages/websockets/src/public-surface.test.ts`
132
132
  - `packages/websockets/src/node/node.test.ts`
133
133
  - `packages/websockets/src/bun/bun.test.ts`
134
+ - `packages/websockets/src/deno/deno.test.ts`
135
+ - `packages/websockets/src/cloudflare-workers/cloudflare-workers.test.ts`
@@ -12,11 +12,14 @@ export declare class BunWebSocketGatewayLifecycleService implements OnApplicatio
12
12
  private readonly logger;
13
13
  private readonly adapter;
14
14
  private readonly moduleOptions;
15
+ private isShuttingDown;
16
+ private readonly pendingUpgradeOperations;
15
17
  private pendingUpgradeReservations;
16
18
  private readonly roomSockets;
17
19
  private shutdownPromise;
18
20
  private readonly socketRegistry;
19
21
  private readonly socketRooms;
22
+ private readonly socketStates;
20
23
  constructor(runtimeContainer: Container, compiledModules: readonly CompiledModule[], logger: ApplicationLogger, adapter: HttpApplicationAdapter, moduleOptions: WebSocketModuleOptions);
21
24
  onApplicationBootstrap(): Promise<void>;
22
25
  private assertNoServerBackedGatewayOptIn;
@@ -27,6 +30,9 @@ export declare class BunWebSocketGatewayLifecycleService implements OnApplicatio
27
30
  private handleUpgradeRequest;
28
31
  private bindConnectionHandlers;
29
32
  private createConnectionHandlerState;
33
+ private settleOpenRegistration;
34
+ private settleConnectLifecycle;
35
+ private settleDisconnectLifecycle;
30
36
  private getBufferedMessageCount;
31
37
  private getQueuedMessageCount;
32
38
  private maybeCompactBufferedMessages;
@@ -52,8 +58,13 @@ export declare class BunWebSocketGatewayLifecycleService implements OnApplicatio
52
58
  private releaseUpgradeReservation;
53
59
  private resolveMaxPayloadBytes;
54
60
  private resolveIdleTimeoutSeconds;
61
+ private resolveShutdownTimeoutMs;
55
62
  private shutdown;
56
63
  private runShutdownLifecycle;
64
+ private trackPendingUpgradeOperation;
65
+ private awaitPendingUpgradeOperations;
66
+ private closeActiveSockets;
67
+ private awaitHandlerQueueDrain;
57
68
  joinRoom(socketId: string, room: string): void;
58
69
  leaveRoom(socketId: string, room: string): void;
59
70
  broadcastToRoom(room: string, event: string, data: unknown): void;
@@ -1 +1 @@
1
- {"version":3,"file":"bun-service.d.ts","sourceRoot":"","sources":["../../src/bun/bun-service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AASzI,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAa3D,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAyG7D;;GAEG;AACH,qBACa,mCACX,YAAW,sBAAsB,EAAE,qBAAqB,EAAE,eAAe,EAAE,oBAAoB;IAS7F,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAXhC,OAAO,CAAC,0BAA0B,CAAK;IACvC,OAAO,CA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yB;IAMjC,OAAO,CAAC,sBAAsB;IAU9B,OAAO,CAAC,yBAAyB;IAcjC,OAAO,CAAC,wBAAwB;YAUlB,QAAQ;YAUR,oBAAoB;IAoBlC,OAAO,CAAC,4BAA4B;YAetB,6BAA6B;YA4C7B,kBAAkB;YAoBlB,sBAAsB;IAkDpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAmB9C,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAc/C,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI;IA4BjE,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAU/C,OAAO,CAAC,gBAAgB;CAiBzB"}
@@ -11,6 +11,7 @@ import { WEBSOCKET_OPTIONS_INTERNAL } from '../options-token.internal.js';
11
11
  const DEFAULT_MAX_PENDING_MESSAGES_PER_SOCKET = 256;
12
12
  const DEFAULT_MAX_WEBSOCKET_CONNECTIONS = 1_000;
13
13
  const DEFAULT_MAX_WEBSOCKET_PAYLOAD_BYTES = 1_048_576;
14
+ const DEFAULT_WEBSOCKET_SHUTDOWN_TIMEOUT_MS = 5_000;
14
15
  const LIFECYCLE_LOG_CONTEXT = 'WebSocketGatewayLifecycleService';
15
16
  function hasBunWebSocketBindingHost(adapter) {
16
17
  return 'configureWebSocketBinding' in adapter && typeof adapter.configureWebSocketBinding === 'function';
@@ -40,6 +41,16 @@ function resolveMessageByteLength(message) {
40
41
  function isWebSocketUpgradeRequest(request) {
41
42
  return request.headers.get('upgrade')?.toLowerCase() === 'websocket';
42
43
  }
44
+ function createCompletionSignal() {
45
+ let resolve;
46
+ const promise = new Promise(res => {
47
+ resolve = res;
48
+ });
49
+ return {
50
+ promise,
51
+ resolve
52
+ };
53
+ }
43
54
 
44
55
  /**
45
56
  * Boots Bun-backed websocket gateways and manages their room lifecycle state.
@@ -49,11 +60,14 @@ class BunWebSocketGatewayLifecycleService {
49
60
  static {
50
61
  [_BunWebSocketGatewayL, _initClass] = _applyDecs(this, [Inject(RUNTIME_CONTAINER, COMPILED_MODULES, APPLICATION_LOGGER, HTTP_APPLICATION_ADAPTER, WEBSOCKET_OPTIONS_INTERNAL)], []).c;
51
62
  }
63
+ isShuttingDown = false;
64
+ pendingUpgradeOperations = new Set();
52
65
  pendingUpgradeReservations = 0;
53
66
  roomSockets = new Map();
54
67
  shutdownPromise;
55
68
  socketRegistry = new Map();
56
69
  socketRooms = new Map();
70
+ socketStates = new Map();
57
71
  constructor(runtimeContainer, compiledModules, logger, adapter, moduleOptions) {
58
72
  this.runtimeContainer = runtimeContainer;
59
73
  this.compiledModules = compiledModules;
@@ -90,7 +104,7 @@ class BunWebSocketGatewayLifecycleService {
90
104
  createBinding(descriptors) {
91
105
  const descriptorsByPath = this.groupDescriptorsByPath(descriptors);
92
106
  return {
93
- fetch: (request, server) => this.handleUpgradeRequest(request, server, descriptorsByPath),
107
+ fetch: (request, server) => this.trackPendingUpgradeOperation(this.handleUpgradeRequest(request, server, descriptorsByPath)),
94
108
  websocket: {
95
109
  backpressureLimit: this.resolveBackpressureLimit(),
96
110
  close: (socket, code, reason) => {
@@ -108,7 +122,7 @@ class BunWebSocketGatewayLifecycleService {
108
122
  this.handleSocketMessage(socket, message);
109
123
  },
110
124
  open: socket => {
111
- void this.bindConnectionHandlers(socket).catch(error => {
125
+ void this.trackPendingUpgradeOperation(this.bindConnectionHandlers(socket)).catch(error => {
112
126
  this.unregisterSocket(socket.data.state.socketId);
113
127
  this.logger.error('WebSocket gateway open lifecycle failed.', error, LIFECYCLE_LOG_CONTEXT);
114
128
  socket.close(1011, 'Internal server error');
@@ -155,7 +169,14 @@ class BunWebSocketGatewayLifecycleService {
155
169
  status: rejection.status
156
170
  });
157
171
  }
172
+ if (this.isShuttingDown) {
173
+ this.releaseUpgradeReservation();
174
+ return new Response('WebSocket server is shutting down.', {
175
+ status: 503
176
+ });
177
+ }
158
178
  const state = this.createConnectionHandlerState(request, [...descriptors]);
179
+ void this.trackPendingUpgradeOperation(state.openRegistrationPromise);
159
180
  let upgraded = false;
160
181
  try {
161
182
  upgraded = server.upgrade(request, {
@@ -164,10 +185,12 @@ class BunWebSocketGatewayLifecycleService {
164
185
  }
165
186
  });
166
187
  } catch (error) {
188
+ this.settleOpenRegistration(state);
167
189
  this.releaseUpgradeReservation();
168
190
  throw error;
169
191
  }
170
192
  if (!upgraded) {
193
+ this.settleOpenRegistration(state);
171
194
  this.releaseUpgradeReservation();
172
195
  return new Response(null, {
173
196
  status: 400
@@ -181,27 +204,73 @@ class BunWebSocketGatewayLifecycleService {
181
204
  } = socket.data;
182
205
  this.releaseUpgradeReservation();
183
206
  this.socketRegistry.set(state.socketId, socket);
184
- await this.resolveConnectionGateways(state);
185
- await this.runConnectHandlers(state, socket);
186
- await this.finalizeConnectionBinding(state, socket);
207
+ this.socketStates.set(state.socketId, state);
208
+ this.settleOpenRegistration(state);
209
+ try {
210
+ await this.resolveConnectionGateways(state);
211
+ await this.runConnectHandlers(state, socket);
212
+ await this.finalizeConnectionBinding(state, socket);
213
+ if (this.isShuttingDown && socket.readyState === 1) {
214
+ socket.close(1001, 'Server shutting down');
215
+ await state.disconnectLifecyclePromise;
216
+ }
217
+ } finally {
218
+ if (!state.handlersReady && state.bufferedDisconnect) {
219
+ this.settleDisconnectLifecycle(state);
220
+ }
221
+ this.settleConnectLifecycle(state);
222
+ }
187
223
  }
188
224
  createConnectionHandlerState(request, descriptors) {
225
+ const connectLifecycle = createCompletionSignal();
226
+ const disconnectLifecycle = createCompletionSignal();
227
+ const openRegistration = createCompletionSignal();
189
228
  return {
190
229
  bufferedDisconnect: undefined,
191
230
  bufferedMessages: [],
192
231
  bufferedMessagesStartIndex: 0,
232
+ connectLifecycleSettled: false,
233
+ connectLifecyclePromise: connectLifecycle.promise,
193
234
  descriptors,
235
+ disconnectLifecycleSettled: false,
236
+ disconnectLifecyclePromise: disconnectLifecycle.promise,
194
237
  enqueuedMessageCount: 0,
195
238
  handlerQueue: Promise.resolve(),
196
239
  handlersReady: false,
240
+ openRegistrationSettled: false,
241
+ openRegistrationPromise: openRegistration.promise,
197
242
  processingMessageQueue: false,
198
243
  queuedMessages: [],
199
244
  queuedMessagesStartIndex: 0,
200
245
  request,
246
+ resolveOpenRegistration: openRegistration.resolve,
247
+ resolveConnectLifecycle: connectLifecycle.resolve,
248
+ resolveDisconnectLifecycle: disconnectLifecycle.resolve,
201
249
  resolved: [],
202
250
  socketId: crypto.randomUUID()
203
251
  };
204
252
  }
253
+ settleOpenRegistration(state) {
254
+ if (state.openRegistrationSettled) {
255
+ return;
256
+ }
257
+ state.openRegistrationSettled = true;
258
+ state.resolveOpenRegistration();
259
+ }
260
+ settleConnectLifecycle(state) {
261
+ if (state.connectLifecycleSettled) {
262
+ return;
263
+ }
264
+ state.connectLifecycleSettled = true;
265
+ state.resolveConnectLifecycle();
266
+ }
267
+ settleDisconnectLifecycle(state) {
268
+ if (state.disconnectLifecycleSettled) {
269
+ return;
270
+ }
271
+ state.disconnectLifecycleSettled = true;
272
+ state.resolveDisconnectLifecycle();
273
+ }
205
274
  getBufferedMessageCount(state) {
206
275
  return state.bufferedMessages.length - state.bufferedMessagesStartIndex;
207
276
  }
@@ -330,6 +399,8 @@ class BunWebSocketGatewayLifecycleService {
330
399
  await dispatchGatewayDisconnect(state.resolved, socket, disconnectEvent.code, disconnectEvent.reason, state.socketId, this.logger, LIFECYCLE_LOG_CONTEXT);
331
400
  }).catch(error => {
332
401
  this.logger.error('WebSocket gateway disconnect dispatch failed.', error, LIFECYCLE_LOG_CONTEXT);
402
+ }).finally(() => {
403
+ this.settleDisconnectLifecycle(state);
333
404
  });
334
405
  }
335
406
  async resolveConnectionGateways(state) {
@@ -379,6 +450,12 @@ class BunWebSocketGatewayLifecycleService {
379
450
  return configured;
380
451
  }
381
452
  async resolveUpgradeRejection(request, path) {
453
+ if (this.isShuttingDown) {
454
+ return {
455
+ body: 'WebSocket server is shutting down.',
456
+ status: 503
457
+ };
458
+ }
382
459
  if (!this.tryReserveUpgradeSlot()) {
383
460
  return {
384
461
  body: 'WebSocket connection limit exceeded.',
@@ -465,6 +542,13 @@ class BunWebSocketGatewayLifecycleService {
465
542
  }
466
543
  return Math.max(1, Math.ceil(configured / 1000));
467
544
  }
545
+ resolveShutdownTimeoutMs() {
546
+ const configured = this.moduleOptions.shutdown?.timeoutMs;
547
+ if (typeof configured !== 'number' || !Number.isFinite(configured) || configured <= 0) {
548
+ return DEFAULT_WEBSOCKET_SHUTDOWN_TIMEOUT_MS;
549
+ }
550
+ return Math.floor(configured);
551
+ }
468
552
  async shutdown() {
469
553
  if (this.shutdownPromise) {
470
554
  await this.shutdownPromise;
@@ -474,15 +558,110 @@ class BunWebSocketGatewayLifecycleService {
474
558
  await this.shutdownPromise;
475
559
  }
476
560
  async runShutdownLifecycle() {
561
+ this.isShuttingDown = true;
477
562
  if (hasBunWebSocketBindingHost(this.adapter)) {
478
563
  const bunAdapter = this.adapter;
479
564
  bunAdapter.configureWebSocketBinding(undefined);
480
565
  }
566
+ const shutdownTimeoutMs = this.resolveShutdownTimeoutMs();
567
+ await this.awaitPendingUpgradeOperations(shutdownTimeoutMs);
568
+ await this.closeActiveSockets(shutdownTimeoutMs);
481
569
  this.pendingUpgradeReservations = 0;
482
570
  this.socketRegistry.clear();
483
571
  this.socketRooms.clear();
572
+ this.socketStates.clear();
484
573
  this.roomSockets.clear();
485
574
  }
575
+ trackPendingUpgradeOperation(operation) {
576
+ let trackedOperation;
577
+ trackedOperation = operation.then(() => undefined, () => undefined).finally(() => {
578
+ if (trackedOperation) {
579
+ this.pendingUpgradeOperations.delete(trackedOperation);
580
+ }
581
+ });
582
+ this.pendingUpgradeOperations.add(trackedOperation);
583
+ return operation;
584
+ }
585
+ async awaitPendingUpgradeOperations(timeoutMs) {
586
+ if (this.pendingUpgradeOperations.size === 0) {
587
+ return;
588
+ }
589
+ await new Promise((resolve, reject) => {
590
+ let settled = false;
591
+ const timeout = setTimeout(() => {
592
+ if (settled) {
593
+ return;
594
+ }
595
+ settled = true;
596
+ reject(new Error(`Timed out while waiting for in-flight Bun websocket upgrades after ${String(timeoutMs)}ms.`));
597
+ }, timeoutMs);
598
+ Promise.all([...this.pendingUpgradeOperations]).then(() => {
599
+ if (settled) {
600
+ return;
601
+ }
602
+ settled = true;
603
+ clearTimeout(timeout);
604
+ resolve();
605
+ }).catch(error => {
606
+ if (settled) {
607
+ return;
608
+ }
609
+ settled = true;
610
+ clearTimeout(timeout);
611
+ reject(error);
612
+ });
613
+ }).catch(error => {
614
+ this.logger.error(`Failed to wait for in-flight Bun websocket upgrades within ${String(timeoutMs)}ms.`, error, LIFECYCLE_LOG_CONTEXT);
615
+ });
616
+ }
617
+ async closeActiveSockets(timeoutMs) {
618
+ const activeSockets = [...this.socketRegistry.entries()];
619
+ if (activeSockets.length === 0) {
620
+ return;
621
+ }
622
+ const activeStates = activeSockets.map(([socketId]) => this.socketStates.get(socketId)).filter(state => state !== undefined);
623
+ for (const [, socket] of activeSockets) {
624
+ if (socket.readyState === 1) {
625
+ socket.close(1001, 'Server shutting down');
626
+ }
627
+ }
628
+ await this.awaitHandlerQueueDrain(activeStates, timeoutMs);
629
+ }
630
+ async awaitHandlerQueueDrain(states, timeoutMs) {
631
+ if (states.length === 0) {
632
+ return;
633
+ }
634
+ await new Promise((resolve, reject) => {
635
+ let settled = false;
636
+ const timeout = setTimeout(() => {
637
+ if (settled) {
638
+ return;
639
+ }
640
+ settled = true;
641
+ reject(new Error(`Timed out while closing Bun websocket connections after ${String(timeoutMs)}ms.`));
642
+ }, timeoutMs);
643
+ Promise.all(states.map(async state => {
644
+ await state.connectLifecyclePromise;
645
+ await state.disconnectLifecyclePromise;
646
+ })).then(() => {
647
+ if (settled) {
648
+ return;
649
+ }
650
+ settled = true;
651
+ clearTimeout(timeout);
652
+ resolve();
653
+ }).catch(error => {
654
+ if (settled) {
655
+ return;
656
+ }
657
+ settled = true;
658
+ clearTimeout(timeout);
659
+ reject(error);
660
+ });
661
+ }).catch(error => {
662
+ this.logger.error(`Failed to close Bun websocket connections within ${String(timeoutMs)}ms.`, error, LIFECYCLE_LOG_CONTEXT);
663
+ });
664
+ }
486
665
  joinRoom(socketId, room) {
487
666
  let rooms = this.socketRooms.get(socketId);
488
667
  if (!rooms) {
@@ -539,6 +718,7 @@ class BunWebSocketGatewayLifecycleService {
539
718
  }
540
719
  unregisterSocket(socketId) {
541
720
  this.socketRegistry.delete(socketId);
721
+ this.socketStates.delete(socketId);
542
722
  const rooms = this.socketRooms.get(socketId);
543
723
  if (rooms) {
544
724
  for (const room of rooms) {
@@ -12,20 +12,26 @@ export declare class CloudflareWorkersWebSocketGatewayLifecycleService implement
12
12
  private readonly logger;
13
13
  private readonly adapter;
14
14
  private readonly moduleOptions;
15
+ private isShuttingDown;
16
+ private readonly pendingUpgradeOperations;
15
17
  private pendingUpgradeReservations;
16
18
  private readonly roomSockets;
17
19
  private shutdownPromise;
18
20
  private readonly socketRegistry;
19
21
  private readonly socketRooms;
22
+ private readonly socketStates;
20
23
  constructor(runtimeContainer: Container, compiledModules: readonly CompiledModule[], logger: ApplicationLogger, adapter: HttpApplicationAdapter, moduleOptions: WebSocketModuleOptions);
21
24
  onApplicationBootstrap(): Promise<void>;
22
25
  private assertNoServerBackedGatewayOptIn;
23
26
  onApplicationShutdown(): Promise<void>;
24
27
  onModuleDestroy(): Promise<void>;
25
28
  private createBinding;
29
+ private handleUpgradeRequest;
26
30
  private groupDescriptorsByPath;
27
31
  private bindConnectionHandlers;
28
32
  private createConnectionHandlerState;
33
+ private settleConnectLifecycle;
34
+ private settleDisconnectLifecycle;
29
35
  private attachConnectionListeners;
30
36
  private getBufferedMessageCount;
31
37
  private getQueuedMessageCount;
@@ -50,8 +56,13 @@ export declare class CloudflareWorkersWebSocketGatewayLifecycleService implement
50
56
  private tryReserveUpgradeSlot;
51
57
  private releaseUpgradeReservation;
52
58
  private resolveMaxPayloadBytes;
59
+ private resolveShutdownTimeoutMs;
53
60
  private shutdown;
54
61
  private runShutdownLifecycle;
62
+ private trackPendingUpgradeOperation;
63
+ private awaitPendingUpgradeOperations;
64
+ private closeActiveSockets;
65
+ private awaitHandlerQueueDrain;
55
66
  joinRoom(socketId: string, room: string): void;
56
67
  leaveRoom(socketId: string, room: string): void;
57
68
  broadcastToRoom(room: string, event: string, data: unknown): void;
@@ -1 +1 @@
1
- {"version":3,"file":"cloudflare-workers-service.d.ts","sourceRoot":"","sources":["../../src/cloudflare-workers/cloudflare-workers-service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEzI,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAa3D,OAAO,KAAK,EAA8B,oBAAoB,EAA6B,MAAM,aAAa,CAAC;AAC/G,OAAO,KAAK,EAKV,sBAAsB,EACvB,MAAM,+BAA+B,CAAC;AA0GvC;;GAEG;AACH,qBACa,iDACX,YAAW,sBAAsB,EAAE,qBAAqB,EAAE,eAAe,EAAE,oBAAoB;IAS7F,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAXhC,OAAO,CAAC,0BAA0B,CAAK;IACvC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkC;IAC9D,OAAO,CAAC,eAAe,CAA4B;IACnD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgD;IAC/E,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA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