Estás leyendo la versión en inglés del artículo porque aún no existe una traducción para este idioma. ¡Ayúdanos a traducir este artículo!

The readyState read-only property of the EventSource interface returns a number representing the state of the connection.


var myReadyState = eventSource.readyState;


A number representing the state of the connection. Possible values are:

  • 0 — connecting
  • 1 — open
  • 2 — closed


var evtSource = new EventSource('sse.php');

Note: You can find a full example on GitHub — see Simple SSE demo using PHP.


Specification Status Comment
HTML Living Standard
The definition of 'readyState' in that specification.
Living Standard Initial definition

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
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 18Firefox Android Full support 45Opera Android Full support 12Safari iOS Full support 5Samsung Internet Android ?


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

See also