Skip to content

Websockets + broadcasting #2602

Discussion options

You must be logged in to vote

Generally the way you handle this is to keep your own collection of connections. You can shove it into Rockets shared state so you can access it from your handlers.

Then to broadcast, you simply iterate over the connections and send. This also allows you to selectively broadcast by filtering, etc.

This is how it is done under the hood in every (?) WS library that offers a built-in broadcast from what I've seen.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@berndmehnert
Comment options

@SergioBenitez
Comment options

@berndmehnert
Comment options

Answer selected by berndmehnert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants