I'm getting my toes wet with web sockets for the first time and I am trying to convince myself (after having read through the RFC and flicking through stack overflow) that it's not possible for frames to arrive out of order, so long as they are sent in the right order in the first place.
For example, let's say I have Alice and Bob connected over a websocket. Alice sends 100 binary messages to Bob in a single-threaded vanilla for loop via Jetty's RemoteEndpoint#sendBytes
method. Bob is listening on the other end and waiting for bytes via WebSocketAdapter#onWebSocketBytes
and adding them in to a queue for processing.
Can Bob receive the bytes out of order? From what I've observed, it doesn't look possible - the websocket code in Jetty seems to 'lock' the connection during the onWebSocketXXXX
calls and so anything out of order is more likely to be my buggy application code.
I'm going to do some more digging/experimenting but was hoping to get a steer from someone who's trod this path before on whether I'm safe to rely on the frames appearing in serial.
Thanks in advance, Nick