System Design · Junior · Question 24 of 75
When should you choose WebSocket?
- ✓Correct answer: When you need frequent two-way exchange in real time
- 2When you need to load a large image faster than regular HTTP
- 3When you need to cache API responses on the browser side
Explanation
WebSocket keeps a persistent connection, and both sides can send messages at any time. The cost is persistent connections on the server, reconnections and scaling. For a server-only stream, SSE is simpler.