I'm building a chat application on top of a REST API, and I want to ensure that messages are displayed to the receiver in the same order as they were produced by the sender. Taking inspiration from the TCP protocol, I thought of adding sequence numbers to the messages, so that if there is a gap between the last message sent and received the app knows to wait for the intervening message (or request a re-transmission after a timeout, etc). My questions are: Is there a more "natural" way to solve this problem? Are there any Python REST packages (or extensions thereof) that already implement this sort of session management? Continue reading...