9
submitted 3 weeks ago* (last edited 3 weeks ago) by [email protected] to c/[email protected]

Hello, I am starting to learn and play around with tokio and multithreaded code. I am now playing around with websockets, I don't quite understand the difference between broadcast and mpsc, and when would you use either, I mean, I am assuming broadcast is intended for multiple clients, but multiple clients were able to connect to my mscp channel, and receive a bit of data (but it was weird and partial). So I don't quite get it.

you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 5 points 3 weeks ago* (last edited 3 weeks ago)

The problem might be the arc mutex. mpsc are already clone, send and sync. When you clone an arc mutex T, you are cloning the arc. But mpsc probably needs to be cloned itself to work properly.

this post was submitted on 11 May 2025
9 points (100.0% liked)

Rust

6958 readers
3 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

[email protected]

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 2 years ago
MODERATORS