The chat widget — How the conversation stays live
The widget polls rather than holding a socket open, and its cursor is a sequence number the database assigns rather than a timestamp. Two messages committed at the same moment can disagree with the clock, and a cursor that disagrees with commit order silently steps over a customer's message. A couple of seconds of latency is the price; not losing what somebody said is what it buys.