Requirements
- Multiple Users, Multiple Channels
- Users DM on Message Channel
- Real-time chat
- Historical messages can be scrolled through
Similar Systems
- Multiplayer Games
- Realtime Chat
- Interactions
- Realtime Polls
- Creator Tools
Brainstorm
- Channels
- Messages
- Checkpoints (Membership)
- Realtime Communication
Database Schema [LLD]
| Users |
|---|
| id |
| name |
| Membership |
|---|
| user_id |
| channel_id |
| [Checkpoint] |
| muted |
| read_till |
| Channels |
|---|
| id |
| user_id |
| org |
| name |
| type: group_id |
| Messages |
|---|
| from |
| channel_id |
| created_at |
| message |
WebSockets
Each user will maintain a single WebSocket connection with our backend infrastructure, which will handle all real-time interactions.
Edge Servers
Because WebSocket are expensive and browsers have a 6 Concurrent TCP connection limit, we have to multiplex all realtime communication on ONE WEBSOCKET connection
Hence, we need a fleet of servers (Edge Servers) to whom our end users connect over WebSocket [WS]
Overall Architecture
