Skip to content

I am trying to use the read and write of a websocket in different threads. #282

Answered by davidpdrsn
lz1998 asked this question in Q&A
Discussion options

You must be logged in to vote

Since WebSocket implements Stream and Sink you can use split to get a read and write half. Those can be moved to different threads.

It's also shown here https://github.com/tokio-rs/axum/blob/main/examples/chat/src/main.rs

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@davidpdrsn
Comment options

@lz1998
Comment options

@davidpdrsn
Comment options

@lz1998
Comment options

Answer selected by davidpdrsn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants