Requirements, APIs, and Message Data Model
Define supported conversation types, membership, message edits/deletes, attachments, read receipts, offline history, retention, and encryption requirements. Core entities include users, conversations, memberships, messages, and device synchronization cursors.
A message record can contain a stable message ID, conversation ID, sender ID, sequence or creation position, content metadata, and server acceptance time. Enforce membership authorization on both sending and reading; knowing a conversation ID must not grant access.
Use cursor pagination for history and define per-conversation ordering. Global order across unrelated conversations adds coordination without improving most user experiences. Separate durable message history from ephemeral presence and typing indicators.
- Define membership and offline behavior before choosing transport.
- Use stable IDs and conversation-scoped ordering.
- Separate durable messages from ephemeral presence.
What is a practical way for a chat client to recover messages missed while disconnected?