Tournaments ~ Implementing the Live Chat in Tournaments - uchicago-cs/chigame GitHub Wiki
Use a Combination of Regular Frontend Query and Robust Backend CRUD Suites to implement live chat
Rather than real-time communication, fetch new messages from the backend regularly (e.g. every 1 seconds).
Some advantages:
- Simpler to implement than WebSockets
- Built on common REST API patterns
- Leverages robust backend CRUD & storage
To implement:
- Create frontend component to fetch messages from API endpoint
- Backend API retrieves new messages from database
- Frontend polls API to check for message updates
- Shows new messages in real-time-like fashion
Some considerations:
- Added latency compared to WebSockets
- Potential overfetching/underfetching of updates
- More API requests required