MCPcopy Create free account
hub / github.com/nodejs/undici / createWebSocketServer

Function createWebSocketServer

docs/examples/proxy/websocket.js:13–24  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11})
12
13function createWebSocketServer () {
14 const wss = new WebSocket.Server({ noServer: true })
15
16 wss.on('connection', ws => {
17 ws.on('message', message => {
18 console.log(`Received message: ${message}`)
19 ws.send('Received your message!')
20 })
21 })
22
23 return wss
24}
25
26async function run () {
27 await Promise.all([

Callers 1

runFunction · 0.85

Calls 2

sendMethod · 0.65
onMethod · 0.45

Tested by

no test coverage detected