1

I have already read through multiple posts on Websockets which highlights the fact that Websockets run on top on TCP Connection and the order is guaranteed. Since, I am new to `Websockets', I have a small query.

I have a simple application in which I am trying to send a large file (1GB) over a websocket connection. I am using rails gem named websocket-rails on server end and their java script client on front end.

I have created a private channel over which events are fired and date is transmitted one after the other. I transfer 500 lines' at a time fromserver to client' over the same channel as a part of the same websocket connection. Is there a possibility that the packets may arrive at different order by any chance ? Do I need to implement any mechanism to re-order the entire file on the client end?

Rahul Goyal
  • 644
  • 1
  • 8
  • 19
  • no, you can trust that order will be maintained, i've never seen out of order, even on fast bursts... – dandavis Jul 27 '16 at 05:31

1 Answers1

1

Websockets have no "events" or "channels". They have only messages which are transported as one or multiple frames. The order of the messages and the frames inside the messages stays the same, i.e. no reordering is done and no interleaving with other messages (control frames might interleave).

How this translates to your "private channel" and "events" is unknown since this might be features of a specific library you are using on top of Websockets.

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172