sdroege / async-tungstenite

Async binding for Tungstenite, the Lightweight stream-based WebSocket implementation
MIT License
396 stars 61 forks source link

Cloning `WebSocketStream`s #96

Closed UE2020 closed 3 years ago

UE2020 commented 3 years ago

Is it possible to share multiple owned clones of one stream?

sdroege commented 3 years ago

Not directly, but you can put them into an Arc and async Mutex to achieve that, or spawn a task that reads/writes to a channels and is filled/emptied from another place, or many other options.

There's no reason to put the additional complexity here if it can be built on top quite easily.