Closed macnibblet closed 7 years ago
It's actually very easy, just create a list of WebsocketConnection and append the active connections on the OnConnection
event and remove them on client.OnDisconnect
. Create a function which will iterate these connections, and call their .To(websocket.Broadcast).Emit
.
Be sure that you do that with channels or with locks in order to avoid any issues!
Heya,
I have a use-case where I want to broadcast the status of something every second to a channel, but I cannot find a way to access the emitters without having an active connection. Any suggestions on how to do this ?