X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Ftypescript%2Fwebsocket-server-pool%2Fws-worker_threads%2Fsrc%2Fmain.ts;h=d5b2cc78e8e4feda873602ea9b1074e581d3d8f9;hb=4b956424db4efaf8778d164b54219a1bba6fc2c3;hp=9edb16b03a399768725b2b904f8186183136574e;hpb=8ebe6c308dc1fc3202980126da043b2855d24780;p=poolifier.git 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 9edb16b0..d5b2cc78 100644 --- a/examples/typescript/websocket-server-pool/ws-worker_threads/src/main.ts +++ b/examples/typescript/websocket-server-pool/ws-worker_threads/src/main.ts @@ -10,10 +10,10 @@ const wss = new WebSocketServer({ port }, () => { }) const emptyFunction = (): void => { - /** Intentional */ + /* Intentional */ } -wss.on('connection', (ws) => { +wss.on('connection', ws => { ws.on('error', console.error) ws.on('message', (message: RawData) => { const { type, data } = JSON.parse( @@ -24,28 +24,28 @@ wss.on('connection', (ws) => { case MessageType.echo: requestHandlerPool .execute({ data }, 'echo') - .then((response) => { + .then(response => { ws.send( JSON.stringify({ type: MessageType.echo, data: response.data }) ) - return null + return undefined }) .catch(emptyFunction) break case MessageType.factorial: requestHandlerPool .execute({ data }, 'factorial') - .then((response) => { + .then(response => { ws.send( JSON.stringify({ type: MessageType.factorial, data: response.data }) ) - return null + return undefined }) .catch(emptyFunction) break