You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
app.ws.use((ctx)=>{/* * `ctx` is the regular koa context created from the `ws` * onConnection `socket.upgradeReq` object. */ctx.websocket.broadcast=function(data){app.ws.server.clients.forEach(functioneach(client){client.send(data);});};// the websocket is added to the context on `ctx.websocket`.ctx.websocket.on('message',function(message){// do something with the message from clientctx.websocket.broadcast('something');});});
I cant using broadcast API from here. Any one know how to use brodcast to send message to all clients connected ?
The text was updated successfully, but these errors were encountered: