Essa é daquelas que parecem simples até o entrevistador emendar um "why?". Abaixo, a estrutura de resposta que passa em entrevista.
Short polling: client asks every X seconds. Simple, wasteful, latency = the interval.
Long polling: client asks; the server HOLDS the request open until there's data; client immediately re-asks. Real-time-ish over plain HTTP.
SSE (Server-Sent Events): ONE long-lived HTTP connection, server → client only. Native browser API (EventSource) with auto-reconnect built in. Perfect for feeds, notifications — and LLM token streaming (this is what AI chat products use).
WebSockets: ONE persistent connection, FULL two-way (client ↔ server). For chat, games, collaborative editing, live payments.
Rule of thumb: only the server pushes → SSE. Both sides talk constantly → WebSockets. Neither → plain HTTP.
Ler é fácil. Falar isso em inglês, sob pressão, com alguém avaliando, é outra história. No VagaGringa esse tópico vira flashcard com repetição espaçada, cai em quiz e entra no simulado.
Treinar este tópico no app