[go: up one dir, main page]

0% found this document useful (0 votes)
20 views1 page

SSE

Uploaded by

namedspheres
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views1 page

SSE

Uploaded by

namedspheres
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Server-Sent Events (SSE)

SSE is a simpler protocol for unidirectional, server-to-client communication over


HTTP. It is designed for scenarios where the server needs to send updates to the
client.

Key Features:
Unidirectional Communication: Data flows only from the server to the client.
Text-Based Protocol: SSE transmits data in plain text, typically in the form of
newline-separated events.
Built-In HTTP Support: SSE works directly over HTTP/HTTPS without requiring a
special protocol.
Automatic Reconnection: Built-in support for reconnection if the connection is
lost.
Event-Driven: SSE allows the server to push named events that the client can listen
for.
How It Works:
The client makes a regular HTTP request to the server with the Accept: text/event-
stream header.
The server responds with a stream of events, which the client processes in real-
time.
The client listens for events using JavaScript's EventSource API.
Use Cases:
Live notifications (e.g., news updates).
Dashboards showing real-time metrics.
Social media feed updates.

You might also like