Server-sent events

Short description: Server push technology

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 media type for SSE is `text/event-stream`.

## Contents

* 1 History
* 2 Browser support
* 3 Libraries
* 3.1 .NET
* 3.2 ASP.NET
* 3.3 C
* 3.4 Erlang
* 3.5 Go
* 3.6 Java
* 3.7 Node.js
* 3.8 Objective C
* 3.9 Perl
* 3.10 PHP
* 3.11 Python
* 3.12 Ruby
* 3.13 Rust
* 3.14 Scala
* 3.15 Swift
* 4 See also
* 5 References
* 6 External links

## 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

* Service Stack EventSource library with both server and client implementations.

### ASP.NET

* SignalR \- Transparent implementation for ASP.NET.

### C

* HaSSEs Asynchronous server-side SSE daemon written in C (It uses one thread for all connected clients).

### Erlang

* Lasse EventSource server handler for Erlang's cowboy
* Shotgun EventSource client in Erlang

### Go

* eventsource EventSource library for Go.
* go-sse SSE implementation for Go.
* sse SSE with optimized decoder for Go
* gosse Server-sided implementation with channel concept and further features for out-of-the-box use.
* sse Server Sent Events server and client for Golang

### Java

* Javalin \- lightweight Java and Kotlin web framework
* jEaSSE \- Server-side asynchronous implementation for Java servlets and Vert.x
* Akka HTTP has SSE support since version 10.0.8
* alpakka Event Source Connector EventSource library for alpakka which supports reconnection
* Spring WebFlux Server and client side Java implementation built on reactive streams and non-blocking servers
* Jersey has a full implementation of JAX-RS support for Server Sent Events as defined in JSR-370
* Micronaut HTTP server supports emitting Server Sent Events
* JeSSE  \- Server-side library with user/session management, group broadcast, and authentication
* Armeria has server and client-side asynchronous SSE implementation built on top of Netty and Reactive Streams
* Play Framework Event Source for server-sent event emission
* SSE Client SSE Client library

### Node.js

* sse-stream \- Node.js/Browserify implementation (client and server).
* total.js \- web application framework for Node.js - example \+ supports WebSockets (RFC 6455)
* eventsource-node \- EventSource client for Node.js
* Thread-SSE \- A library for Node.js and web browser to develop security and high-performance SSE.

### Objective C

* TRVSEventSource \- EventSource implementation in Objective-C for iOS and macOS using NSURLSession.

### Perl

* Mojolicious \- Perl real-time web framework.

### PHP

* Hoa\Eventsource \- Server implementation.

### Python

* Python SSE Client \- EventSource client library for Python using Requests library.
* Server Side Events (SSE) client for Python \- EventSource client library for Python using Requests or urllib3 library.
* django-eventstream \- Server-Sent Events for Django.
* flask-sse \- A simple Flask extension powered by Redis.
* sse
* SSE protocol for Starlette \- Server sent events for starlette and FastApi.
* event-source-library \- Implementation in python2 with Tornado. Client and server implementations.
* aiohttp-sse \- Server-sent events support for aiohttp.
* SSE Package \- Modern EventSource library written in Python3.10.

### Ruby

* Faye \- Simple pub/sub messaging for the web.
* Iodine \- HTTP, WebSockets and EventSource (SSE) and Native Pub/Sub.

### Rust

* hyper A low-level HTTP library.
* Warp A web server framework.

### Scala

* Akka HTTP has SSE support since version 10.0.8
* alpakka Event Source Connector EventSource library for alpakka which supports reconnection

### Swift

* EventSource \- EventSource implementation using NSURLSession.

## See also

* Chunked transfer encoding
* Push technology
* Comet

## References

1. ↑ "HTML Living Standard: 9.2 Server-sent events". WHATWG. 31 March 2022. https://html.spec.whatwg.org/multipage/server-sent-events.html.
2. ↑ "Web Applications 1.0 specification". 2006-09-01. http://www.whatwg.org/specs/web-apps/current-work/#scs-server-sent.
3. ↑ Bersvendsen, Arve (1 September 2006). "Event Streaming to Web Browsers". http://dev.opera.com/blog/event-streaming-to-web-browsers/.
4. ↑ Stream Updates with Server-Sent Events, Eric Bidelman, HTML5Rocks website.
5. ↑ When can I use... Server-sent DOM events

## External links

* Server-Sent Events. HTML Living Standard.
* HTML5 Server-push Technologies, Part 1. Introduction into HTML5 Server-push Technologies. Part 1 covers ServerSent Events.
* Using Server-Sent Events. A concise example of how to use server-sent events, on the Mozilla Developer Network.
* EventSource reference on MDN
* Django push: Using Server-Sent Events and WebSocket with Django Django push: Using Server-Sent Events and WebSocket with Django.
* Server-Sent Events vs WebSockets

* v
* t
* e

Web interfaces

Server-side|

| Protocols|

* HTTP
* CGI
* SCGI
* FCGI
* AJP
* WSRP
* WebSocket

|

Server APIs|

* C NSAPI
* C ASAPI
* C ISAPI
* COM ASP
* Java servlet
* container
* CLI OWIN
* ASP.NET Handler
* Python WSGI
* Ruby Rack
* JavaScript JSGI
* Perl PSGI
* Lua WSAPI
* Portlet
* container

Apache modules|

* mod include
* mod jk
* mod lisp
* mod mono
* mod parrot
* mod perl
* mod php
* mod proxy
* mod python
* mod wsgi
* mod ruby
* Phusion Passenger

Topics|

* Web resource vs. Web service
* Open API
* Webhook
* Application server
* comparison
* Scripting

Client-side|

| Browser APIs|

* C NPAPI
* LiveConnect
* XPConnect
* C NPRuntime
* C PPAPI
* NaCl
* ActiveX
* BHO
* XBAP

|

Web APIs|

| W3C|

* Audio
* Canvas
* CORS
* DOM
* DOM events
* EME
* File
* Geolocation
* IndexedDB
* MSE
* SSE
* SVG
* Video
* WebAuthn
* WebRTC
* WebSocket
* Web messaging
* Web storage
* Web worker
* XMLHttpRequest
* WebAssembly

|

Khronos|

* WebCL
* WebGL

Others|

* Gears
* Web SQL Database (formerly W3C)
* WebUSB

Topics|

* Ajax and Remote scripting vs. DHTML
* Mashup
* Web IDL
* Scripting

Topics|

* Dynamic web page
* Web standards
* Rich web application
* Web API security
* Web application
* Web framework

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Server-sent events. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Server-sent_events&oldid=214485"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template