Three building blocks exist and serve different purposes:
- ChatSyncService (
src/services/chat/ChatSyncService.ts) — client state machine for a single device. Manages connection, pending operations, typing/presence, and delivers events viaChatSyncEventBus. Use this inside UI/hooks (useChatSync) for local session sync. - CrossDeviceChatSyncHub (
src/services/chat/CrossDeviceChatSyncHub.ts) — in-memory hub to relay payloads across multiple event buses (e.g., mobile/web). Maintains pending queues per device and deduplicates origin events. Use in tests or local multi-endpoint simulation. - ChatSyncHubBridge (
src/services/chat/ChatSyncHubBridge.ts) — adapter that connects aChatSyncEventBusto a hub, publishing outbound payloads and applying inbound ones. Instantiate per device, passing its bus and the shared hub.