4 ms·
Had a problem with this recently. Switched from Websockets to SSE and then couldnt understand why messages were coming out of order. Had to implement microtime
by alt227 2mo ago
Had a problem with this recently. Switched from Websockets to SSE and then couldnt understand why messages were coming out of order. Had to implement microtime timestamps on each sent message and then perform a check on the client to disregard any messages with older timestamps than the max currently seen for that entity.
Nothing I read anywhere on the setup and testing told me that SSE events were not guaranteed in order. I may have been blind, but I spent a week researching testing and setting it up in a live environment. You would have thought I would see something in that time!
- josephg 2mo agoEvents sent over an sse stream should be in order. It’s a single tcp stream with messages separated by newlines. If you’re seeing messages arrive out of order, there may be a bug in whatever sse stream library you’re using. Http messages of course have no ordering guarantee. If you want ordering (and connection state), websockets might be a better choice.