Server-Sent Events (SSE) is a server push technology enabling a client to receive automatic updates from a server via an HTTP connection, and describes how servers can initiate data transmission towards clients once an initial client connection has been established. They are commonly used to send message updates or continuous data streams to a browser client and designed to enhance native, cross-browser streaming through a JavaScript API called EventSource, through which a client requests a particular URL in order to receive an event stream. The EventSource API is standardized as part of HTML5[1] by the WHATWG. The mime type for SSE is text/event-stream.

History

The SSE mechanism was first specified by Ian Hickson as part of the "WHATWG Web Applications 1.0" proposal starting in 2004.[2] In September 2006, the Opera web browser implemented the experimental technology in a feature called "Server-Sent Events".[3][4]

Browser support

All modern browsers support server-sent events: Firefox 6+, Google Chrome 6+, Opera 11.5+, Safari 5+, Microsoft Edge 79+.[5]

Libraries

.NET

ASP.NET

C

Erlang

Go

Java

Node.js

Objective C

Perl

PHP

Python

Ruby

Rust

Scala

Swift

See also

References

  1. ^ "HTML Living Standard: 9.2 Server-sent events". WHATWG. 31 March 2022.
  2. ^ "Web Applications 1.0 specification". WHATWG. 2006-09-01. Archived from the original on 2006-09-01. Retrieved 2006-09-01.((cite web)): CS1 maint: unfit URL (link)
  3. ^ Bersvendsen, Arve (1 September 2006). "Event Streaming to Web Browsers". dev.opera.com.
  4. ^ Stream Updates with Server-Sent Events, Eric Bidelman, HTML5Rocks website.
  5. ^ When can I use... Server-sent DOM events