TypeScript WebSocket timeline reconstruction failing on event ordering

const ws = new WebSocket(${WEBSOCKET_URL}/v2/notifications/events);
ws.onmessage = (e) => {
const evt = JSON.parse(e.data);
if (!EVENT_CACHE.has(evt.id)) EVENT_CACHE.set(evt.id, evt.lamport_ts);
if (EVENT_CACHE.size > BACKPRESSURE_LIMIT) flushToTIME_SERIES_DB();
};

The LAMPORT_CLOCK sequencing breaks when media channel updates arrive before participant join events, and the flush routine doesn’t handle out-of-order packets. Relying on GENERAL settings for the flush interval. Query API for historical playback just hangs.