Polling, long polling, SSE or WebSocket: how do you get real-time data?
The gist
The update delivery mechanism is chosen along three axes: direction (server → client only, or both ways), frequency and required latency, and cost for the battery and the server. For rare events polling or push is enough, for a stream of server events — SSE, for interactive two-way exchange — WebSocket.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep