+ var session = Math.random(); // For outgoing message IDs
+ var since = {}; // server -> time: For fetch?since=
+ var seen = {}; // seen_key -> message
+ var history = []; // List of messages sorted by Time
+ // Messages have these fields:
+ // Time: The timestamp. Median of ServerTimes
+ // ID: Some unique string for deduping
+ // Text: The text of the message
+ // ServerTimes: server -> timestamp
+ // UI: The DOM node for this message in the UI