Why do messages arrive not in order

We can't guarantee the messages will be received in order on the client, because the messages are processed by many machines in parallel on our backend. However, a good solution to this problem is to publish every message with an increasing ID – then if the client receives message five after message 3, then they know they first need to wait for message four before doing anything. Another way is to manually wrap your events with a timestamp.

You can also take this further and store a message history on the server; then if a message ever gets missed, the client can ask for it to be resent.

 

If you publish events in batches, Pusher guarantees that the order of events within the batch is maintained.

Was this article helpful?
0 out of 0 found this helpful
Haven't found what you were looking for?
Submit a ticket