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
In a simple scenario, let's say a chat, when I have to broadcast all incoming websocket messages to all server participants, do I have to clone it as many times as the number of participants? The message is a text and is constant. Shouldn't I be allowed to send Arc<Message> to websocket streams/sinks?
The text was updated successfully, but these errors were encountered:
We have an old issue to address: snapview/tungstenite-rs#96 (comment)
I think we even agreed upon the solution (see discussion and linked issues), but it has not been fully implemented.
However, it does not mean that we won't perform any copies at all, since we would need to internally allocate a buffer when sending a message, so the message will still be copied (sort of), yet it would indeed be more efficient than copying the Message just before passing to the sink (given that the message will be copied and dropped after that). So yeah, for a broadcast scenario of a large message to many participants, we might be a bit inefficient.
I'm going to close this one since we have an open tracking issue for this. Once it's implemented in tungstenite, adapting tokio-tungstenite won't be a big deal.
In a simple scenario, let's say a chat, when I have to broadcast all incoming websocket messages to all server participants, do I have to clone it as many times as the number of participants? The message is a text and is constant. Shouldn't I be allowed to send
Arc<Message>
to websocket streams/sinks?The text was updated successfully, but these errors were encountered: