-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebSocket::try_recv #2695
Comments
The alternative to using
The axum websocket example follows this pattern. |
Thank you! |
I don't know much about websockets but |
I skimmed over |
Feature Request
Motivation
WebSocket::recv
blocks the runtime, causing it to wait for a new message. Consequently, when I shareArc<Mutex<WebSocket>>
between threads, all threads are blocked until the client sends a message, which would release the block temporarily by triggering a new loop iteration.Proposal
I propose implementing
WebSocket::try_recv
, which would give instant feedback, whether there is a message received from client or not.Alternatives
I have no idea how to solve this problem alternatively.
The text was updated successfully, but these errors were encountered: