SSE = Server-Sent Events It is a one-way real-time communication method where the server continuously pushes data to the browser over a single long-lived HTTP connection. Think of SSE as: Server → Browser (only one-way) live updates Not two-way like WebSockets. How SSE works (simple explanation) Browser opens a connection: Server keeps the connection open and keeps sending events: Browser receives them instantly as they come. Where SSE is used? Live notifications Chat message updates (receive only) Live counters, analytics Stock tickers Live logs News feed updates Dashboard updates SSE vs WebSocket Feature SSE WebSocket Direction One-way (Server → Client) Two-way Transport HTTP TCP Reconnection Built-in automatic Must implement Binary data No Yes Simpler Yes More complex Example Server sends: Browser receives: Why choose SSE over WebSocket? SSE is better when: You only need server → browser updates Lightweight notifications You want automatic reconnection You want simpler code and less overhead API-driven architecture already uses HTTP
Think of SSE as:
Server → Browser (only one-way) live updates
Not two-way like WebSockets.
How SSE works (simple explanation)
Where SSE is used?
SSE vs WebSocket
Example
Server sends:
Browser receives:
Why choose SSE over WebSocket?
SSE is better when: