docs: use kill handler in ws-cluster example
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 15 Aug 2023 15:47:30 +0000 (17:47 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 15 Aug 2023 15:47:30 +0000 (17:47 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
examples/typescript/websocket-server-pool/ws-cluster/package.json
examples/typescript/websocket-server-pool/ws-cluster/pnpm-lock.yaml
examples/typescript/websocket-server-pool/ws-cluster/src/worker.ts
src/index.ts

index 0f963a9ae73589945e8f014c51224a2a50e63ac1..f5405bcde58735788b2385390b51078f3447c65b 100644 (file)
@@ -19,7 +19,7 @@
   "author": "",
   "license": "ISC",
   "dependencies": {
-    "poolifier": "^2.6.25",
+    "poolifier": "^2.6.26",
     "ws": "^8.13.0"
   },
   "devDependencies": {
index 5e00a095de9d6f29dbdae7f53a40fa56827e9568..caa1d26cb7c1b9e5f398cc0b06e507ad20f208f3 100644 (file)
@@ -6,8 +6,8 @@ settings:
 
 dependencies:
   poolifier:
-    specifier: ^2.6.25
-    version: 2.6.25
+    specifier: ^2.6.26
+    version: 2.6.26
   ws:
     specifier: ^8.13.0
     version: 8.13.0(bufferutil@4.0.7)(utf-8-validate@6.0.3)
@@ -79,15 +79,15 @@ packages:
       tslib:
         optional: true
     dependencies:
-      '@rollup/pluginutils': 5.0.2(rollup@3.28.0)
+      '@rollup/pluginutils': 5.0.3(rollup@3.28.0)
       resolve: 1.22.4
       rollup: 3.28.0
       tslib: 2.6.1
       typescript: 5.1.6
     dev: true
 
-  /@rollup/pluginutils@5.0.2(rollup@3.28.0):
-    resolution: {integrity: sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==}
+  /@rollup/pluginutils@5.0.3(rollup@3.28.0):
+    resolution: {integrity: sha512-hfllNN4a80rwNQ9QCxhxuHCGHMAvabXqxNdaChUSSadMre7t4iEUI6fFAhBOn/eIYTgYVhBv7vCLsAJ4u3lf3g==}
     engines: {node: '>=14.0.0'}
     peerDependencies:
       rollup: ^1.20.0||^2.0.0||^3.0.0
@@ -393,8 +393,8 @@ packages:
     engines: {node: '>=8.6'}
     dev: true
 
-  /poolifier@2.6.25:
-    resolution: {integrity: sha512-e8RNC8txuDO7x1ALNMDTUVWyrsMCod3krp/ZIhR+L9Q0KpoywwHekyWnRB4V2PYW/B1yxvXoPbQi1a2hZOfsNw==}
+  /poolifier@2.6.26:
+    resolution: {integrity: sha512-cfcP3oCwtxG5DzxLXicUQjr6ieJzX/5/yT2Nt0tBByhufqtu6V2Son7kJXSHlWrNa08Y39cOaeNrOLCazoJ07w==}
     engines: {node: '>=16.14.0', pnpm: '>=8.6.0'}
     requiresBuild: true
     dev: false
index efe0facdc900b96ae4b4d49d36da3729a598147a..7785a0d6d2f2191f33a9e362853971bd0f86f1c3 100644 (file)
@@ -62,7 +62,11 @@ class WebSocketServerWorker extends ClusterWorker<WorkerData, WorkerResponse> {
   }
 
   public constructor () {
-    super(WebSocketServerWorker.startWebSocketServer)
+    super(WebSocketServerWorker.startWebSocketServer, {
+      killHandler: () => {
+        WebSocketServerWorker.wss.close()
+      }
+    })
   }
 }
 
index c9ee4c6376774d73edf2d9328ab33a9880c1ebf1..a4e22756afc61c8bfe9bd0ff58b088d2031b06c3 100644 (file)
@@ -50,7 +50,11 @@ export type { AbstractWorker } from './worker/abstract-worker'
 export { ClusterWorker } from './worker/cluster-worker'
 export { ThreadWorker } from './worker/thread-worker'
 export { KillBehaviors } from './worker/worker-options'
-export type { KillBehavior, WorkerOptions } from './worker/worker-options'
+export type {
+  KillBehavior,
+  WorkerOptions,
+  KillHandler
+} from './worker/worker-options'
 export type {
   TaskAsyncFunction,
   TaskFunction,