Design a scalable real-time chat system that supports both one-on-one and group conversations, with features like online/offline status and message delivery guarantees. Focus on the architecture for handling real-time messages, storing chat history, and ensuring low latency in message delivery.