repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1301 from poolifier/dependabot/npm_and_yarn/examples/typescript...
[poolifier.git]
/
examples
/
typescript
/
websocket-server-pool
/
ws-cluster
/
src
/
worker.ts
diff --git
a/examples/typescript/websocket-server-pool/ws-cluster/src/worker.ts
b/examples/typescript/websocket-server-pool/ws-cluster/src/worker.ts
index 7785a0d6d2f2191f33a9e362853971bd0f86f1c3..5e758eb7d3f845e1d8508bf907bda9fa7fcbcc3d 100644
(file)
--- a/
examples/typescript/websocket-server-pool/ws-cluster/src/worker.ts
+++ b/
examples/typescript/websocket-server-pool/ws-cluster/src/worker.ts
@@
-8,7
+8,7
@@
import {
type WorkerResponse
} from './types.js'
type WorkerResponse
} from './types.js'
-const factorial: (n: number) => number =
(n)
=> {
+const factorial: (n: number) => number =
n
=> {
if (n === 0) {
return 1
}
if (n === 0) {
return 1
}
@@
-22,13
+22,14
@@
class WebSocketServerWorker extends ClusterWorker<WorkerData, WorkerResponse> {
workerData?: WorkerData
): WorkerResponse => {
const { port } = workerData as WorkerData
workerData?: WorkerData
): WorkerResponse => {
const { port } = workerData as WorkerData
+
WebSocketServerWorker.wss = new WebSocketServer({ port }, () => {
console.info(
`⚡️[ws server]: WebSocket server is started in cluster worker at ws://localhost:${port}/`
)
})
WebSocketServerWorker.wss = new WebSocketServer({ port }, () => {
console.info(
`⚡️[ws server]: WebSocket server is started in cluster worker at ws://localhost:${port}/`
)
})
- WebSocketServerWorker.wss.on('connection',
(ws)
=> {
+ WebSocketServerWorker.wss.on('connection',
ws
=> {
ws.on('error', console.error)
ws.on('message', (message: RawData) => {
const { type, data } = JSON.parse(
ws.on('error', console.error)
ws.on('message', (message: RawData) => {
const { type, data } = JSON.parse(