Traditionally, a web page has to send a request to the server to receive new data; that is, the page requests data from the server. With server-sent events, it's possible for a server to send new data to a web page at any time, by pushing messages to the web page. These incoming messages can be treated as Events + data inside the web page.

Concepts and usage

To learn how to use server-sent events, see our article Using server-sent events.

Interfaces

EventSource
Defines all the features that handle connecting to a server, receiving events/data, errors, closing a connection, etc.

Examples

Specification

Specification Status Comment
HTML Living Standard
The definition of 'Server-sent events' in that specification.
Living Standard  

Browser compatibility

EventSource interface

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support 6Edge No support NoFirefox Full support 6IE No support NoOpera Full support YesSafari Full support 5WebView Android Full support YesChrome Android Full support 18Edge Mobile No support NoFirefox Android Full support 45Opera Android Full support 12Safari iOS Full support 5Samsung Internet Android ?
Available in workersChrome Full support YesEdge No support NoFirefox Full support 53IE No support NoOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile No support NoFirefox Android Full support 53Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?
EventSource() constructorChrome Full support 9Edge No support NoFirefox Full support 6IE No support NoOpera Full support 11Safari Full support 5WebView Android Full support YesChrome Android Full support 18Edge Mobile No support NoFirefox Android Full support 6Opera Android Full support 11Safari iOS Full support 5Samsung Internet Android ?
closeChrome Full support 6Edge No support NoFirefox Full support 6IE No support NoOpera Full support YesSafari Full support 5WebView Android Full support YesChrome Android Full support 18Edge Mobile No support NoFirefox Android Full support 45Opera Android Full support 12Safari iOS Full support 5Samsung Internet Android ?
onerrorChrome Full support 6Edge No support NoFirefox Full support 6IE No support NoOpera Full support YesSafari Full support 5WebView Android Full support YesChrome Android Full support 18Edge Mobile No support NoFirefox Android Full support 45Opera Android Full support 12Safari iOS Full support 5Samsung Internet Android ?
onmessageChrome Full support 6Edge No support NoFirefox Full support 6IE No support NoOpera Full support YesSafari Full support 5WebView Android Full support YesChrome Android Full support 18Edge Mobile No support NoFirefox Android Full support 45Opera Android Full support 12Safari iOS Full support 5Samsung Internet Android ?
onopenChrome Full support 6Edge No support NoFirefox Full support 6IE No support NoOpera Full support YesSafari Full support 5WebView Android Full support YesChrome Android Full support 18Edge Mobile No support NoFirefox Android Full support 45Opera Android Full support 12Safari iOS Full support 5Samsung Internet Android ?
readyStateChrome Full support 6Edge No support NoFirefox Full support 6IE No support NoOpera Full support YesSafari Full support 5WebView Android Full support YesChrome Android Full support 18Edge Mobile No support NoFirefox Android Full support 45Opera Android Full support 12Safari iOS Full support 5Samsung Internet Android ?
urlChrome Full support 6Edge No support NoFirefox Full support 6IE No support NoOpera Full support YesSafari Full support 5WebView Android Full support YesChrome Android Full support 18Edge Mobile No support NoFirefox Android Full support 45Opera Android Full support 12Safari iOS Full support 5Samsung Internet Android ?
withCredentialsChrome Full support 6Edge No support NoFirefox Full support 6IE No support NoOpera Full support YesSafari Full support 5WebView Android Full support YesChrome Android Full support 18Edge Mobile No support NoFirefox Android Full support 45Opera Android Full support 12Safari iOS Full support 5Samsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

See also

Tools

Other resources

Document Tags and Contributors

Last updated by: fscholz,