Ws: Is the order of messages guaranteed?

Created on 7 Aug 2015  Â·  2Comments  Â·  Source: websockets/ws

I did not find it explicitly in the RFC.

Is the order of operations guaranteed?

In other words

if clients do

// first op - client 1
.send(1)

// second op - client 2
.send(2)

then the receiver always receives

2

and never

1

Could you confirm it?

Most helpful comment

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.

All 2 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 :+1: nicely said– thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bartosz-m picture bartosz-m  Â·  3Comments

robertmylne picture robertmylne  Â·  3Comments

dcflow picture dcflow  Â·  4Comments

ORESoftware picture ORESoftware  Â·  3Comments

pmcalabrese picture pmcalabrese  Â·  4Comments