mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-21 21:49:51 +01:00
22 lines
639 B
HTML
22 lines
639 B
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<body>
|
||
|
<h1>Getting server updates</h1>
|
||
|
<div id="result"></div>
|
||
|
|
||
|
<script>
|
||
|
// Example taken from: https://www.w3schools.com/html/html5_serversentevents.asp
|
||
|
if (typeof EventSource !== "undefined") {
|
||
|
const source = new EventSource("/sse");
|
||
|
source.onmessage = function (event) {
|
||
|
console.log(event);
|
||
|
document.getElementById("result").innerHTML += event.data + "<br>";
|
||
|
};
|
||
|
} else {
|
||
|
document.getElementById("result").innerHTML =
|
||
|
"Sorry, your browser does not support server-sent events...";
|
||
|
}
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|