API Fundamentals
/Intermediate
Server-Sent Events (SSE)
Definition
A standard allowing a browser to receive automatic updates (event streams) from a server via an HTTP connection. It is strictly a one-way communication channel (Server to Client).
Explain Like I'm New
WebSockets is a two-way phone call. SSE is a one-way radio broadcast. The client tunes in to the station, and the server continuously streams data to them. The client cannot talk back on that channel.
Real World Example
A live Twitter feed or a live sports score ticker. The user is just watching the data flow in. They don't need to send complex high-speed data back to the server, so a full WebSocket is overkill. SSE handles this perfectly over standard HTTP.
Common Use Cases
- •Live scoreboards
- •News feeds
- •Streaming AI text (ChatGPT)
Interactive Example
Loading...
Console output will appear here...
Interview Questions
basic
- Which is generally easier to set up through corporate firewalls and load balancers: WebSockets or Server-Sent Events?
intermediate
- If a client needs to send a chat message while listening to an SSE stream, how do they do it?