EventSource.onopen

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

La propriété onopen de l'interface EventSource est un gestionnaire d'évènement qui est appelé lorsqu'un est évènement open est reçu, indiquant que la connexion vient d'être établie.

Syntaxe

js
eventSource.onopen = function

Exemples

js
evtSource.onopen = function () {
  console.log("Connexion au serveur établie.");
};

Note : Vous pouvez trouver un exemple complet sur GitHub — voir Simple SSE demo using PHP.

Spécifications

Specification
HTML
# event-open
HTML
# handler-eventsource-onopen

Compatibilité des navigateurs

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
open event

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Voir aussi