-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Is the order of messages guaranteed? #542
Comments
TCP itself offers in-order, exactly-once delivery guarantee so yes WS also does by extension. HTTP doesn't provide this guarantee because HTTP requests may be spread over multiple TCP connections (and this negates the guarantee). Since a WebSocket uses a single TCP connection, this guarantee is maintained. |
@jondubois 👍 nicely said– thanks. |
It appears to be possible: https://x.com/ThePrimeagen/status/1796262882721587362 |
@patrickelectric I believe the issue is specific to that implementation itself awaiting on blob.arrayBuffer() which can take longer to resolve for some messages than others. So the messages arrive in-order but they finish processing in a potentially different order. It's the exact reason why SocketCluster focuses on for-await-of loops. So it shouldn't be an issue with SC if you use it as documented. With a for-await-of loop, each iteration blocks on each await so you can't end up with such race conditions, even if you add some additional async processing to each message. |
I did not find it explicitly in the RFC.
Is the order of operations guaranteed?
In other words
if clients do
then the receiver always receives
and never
Could you confirm it?
The text was updated successfully, but these errors were encountered: