Search code examples
javatomcatwebsocketjava-websocket

Does WebSocket's ClientEndpoint receive data in the same order it was sent by the ServerEndpoint?


I'm using RemoteEndpoint.Async's sendText() method in a loop to send some data to the ClientEndPoint. As the data is sent asynchronously from the ServerEndpoint, will it be received by the ClientEndpoint in the same order as it was sent ?


Solution

  • Not necessary. There are always channel threads transmitting data to the clients on websocket on a single connection. Data can come in any order.Although attempt to deliver the data will be ASAP but race conditions may occurr.