PROJET AUTOBLOG


shaarli-Links

Site original : shaarli-Links

⇐ retour index

Server-Sent Events: the alternative to WebSockets you should be using - germano.dev

vendredi 4 mars 2022 à 21:41
const es = new EventSource("https://localhost/sse");

es.onopen = e => console.log("EventSource open");

es.addEventListener("message", e => console.log(e.data));

// Event listener for custom event
es.addEventListener( "join", e => console.log(`${e.data} joined`))

https://github.com/tyrion/sse-websockets-demo

via https://sebsauvage.net/links/?CEiR6w
Permalink