Replies: 1 comment
-
This example codebase uses several mpsc channels: https://github.com/darksonn/telnet-chat |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm a bit of a noob to rust and struggling to determine what's the best approach for my need.
My app is more or less a notification system. I want to send messages/events from a server to client. There will be times when the message needs to go to various clients or a single client depending on the event. Communication needs only to be one way from server to client so I believe SSE seems to be the right fit.
I've been researching and am a bit confused on the "recommended" solution for this task. Much of the information I'm finding seem to point at using tokio::sync::broadcast and I've been able to put a working sample together using broadcast but my confusion or question becomes how do I send a message/event to just a single client. Further research seems to point to using tokio::sync::mpsc but I'm not able to find many examples of how to use this and the ones I do find, seem to suggest using broadcast instead. I was able to find some examples of using mpsc with actix which I "converted" to axum and this works but the examples seem to send to all clients again.
I'm hoping someone can give me some suggestions on how to approach this and if you know of any sample code to point me in the right direction it would be very much appreciated.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions