repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build(deps-dev): apply updates
[poolifier.git]
/
examples
/
typescript
/
websocket-server-pool
/
ws-worker_threads
/
src
/
main.ts
diff --git
a/examples/typescript/websocket-server-pool/ws-worker_threads/src/main.ts
b/examples/typescript/websocket-server-pool/ws-worker_threads/src/main.ts
index 6283759d403047be2837b8322147f0741973adcd..7a162499d8f91417246fe1b94289b62083ec584d 100644
(file)
--- a/
examples/typescript/websocket-server-pool/ws-worker_threads/src/main.ts
+++ b/
examples/typescript/websocket-server-pool/ws-worker_threads/src/main.ts
@@
-1,6
+1,7
@@
import { type RawData, WebSocketServer } from 'ws'
import { type RawData, WebSocketServer } from 'ws'
-import { type DataPayload, type MessagePayload, MessageType } from './types.js'
+
import { requestHandlerPool } from './pool.js'
import { requestHandlerPool } from './pool.js'
+import { type DataPayload, type MessagePayload, MessageType } from './types.js'
const port = 8080
const wss = new WebSocketServer({ port }, () => {
const port = 8080
const wss = new WebSocketServer({ port }, () => {
@@
-10,7
+11,7
@@
const wss = new WebSocketServer({ port }, () => {
})
const emptyFunction = (): void => {
})
const emptyFunction = (): void => {
- /*
*
Intentional */
+ /* Intentional */
}
wss.on('connection', ws => {
}
wss.on('connection', ws => {
@@
-31,7
+32,7
@@
wss.on('connection', ws => {
data: response.data
})
)
data: response.data
})
)
- return
null
+ return
undefined
})
.catch(emptyFunction)
break
})
.catch(emptyFunction)
break
@@
-40,12
+41,15
@@
wss.on('connection', ws => {
.execute({ data }, 'factorial')
.then(response => {
ws.send(
.execute({ data }, 'factorial')
.then(response => {
ws.send(
- JSON.stringify({
- type: MessageType.factorial,
- data: response.data
- })
+ JSON.stringify(
+ {
+ type: MessageType.factorial,
+ data: response.data
+ },
+ (_, v) => (typeof v === 'bigint' ? v.toString() : v)
+ )
)
)
- return
null
+ return
undefined
})
.catch(emptyFunction)
break
})
.catch(emptyFunction)
break