repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test: fix worker tests
[poolifier.git]
/
examples
/
typescript
/
websocket-server-pool
/
ws-hybrid
/
src
/
websocket-server-worker.ts
diff --git
a/examples/typescript/websocket-server-pool/ws-hybrid/src/websocket-server-worker.ts
b/examples/typescript/websocket-server-pool/ws-hybrid/src/websocket-server-worker.ts
index 437fae1b45600c5cb0bc700d690569c820b44b5e..46745d9657cc9f700fc3f9ad79789b8323bf0715 100644
(file)
--- a/
examples/typescript/websocket-server-pool/ws-hybrid/src/websocket-server-worker.ts
+++ b/
examples/typescript/websocket-server-pool/ws-hybrid/src/websocket-server-worker.ts
@@
-15,7
+15,7
@@
import {
} from './types.js'
const emptyFunction = (): void => {
} from './types.js'
const emptyFunction = (): void => {
- /*
*
Intentional */
+ /* Intentional */
}
class WebSocketServerWorker extends ClusterWorker<
}
class WebSocketServerWorker extends ClusterWorker<
@@
-50,7
+50,7
@@
ClusterWorkerResponse
)
})
)
})
- 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(
@@
-61,28
+61,28
@@
ClusterWorkerResponse
case MessageType.echo:
WebSocketServerWorker.requestHandlerPool
.execute({ data }, 'echo')
case MessageType.echo:
WebSocketServerWorker.requestHandlerPool
.execute({ data }, 'echo')
- .then(
(response)
=> {
+ .then(
response
=> {
ws.send(
JSON.stringify({
type: MessageType.echo,
data: response.data
})
)
ws.send(
JSON.stringify({
type: MessageType.echo,
data: response.data
})
)
- return
null
+ return
undefined
})
.catch(emptyFunction)
break
case MessageType.factorial:
WebSocketServerWorker.requestHandlerPool
.execute({ data }, 'factorial')
})
.catch(emptyFunction)
break
case MessageType.factorial:
WebSocketServerWorker.requestHandlerPool
.execute({ data }, 'factorial')
- .then(
(response)
=> {
+ .then(
response
=> {
ws.send(
JSON.stringify({
type: MessageType.factorial,
data: response.data
})
)
ws.send(
JSON.stringify({
type: MessageType.factorial,
data: response.data
})
)
- return
null
+ return
undefined
})
.catch(emptyFunction)
break
})
.catch(emptyFunction)
break