iris/_examples/response-writer/sse-third-party-2/index.html
Gerasimos (Makis) Maropoulos 61f04ee4ff
examples: minor (see previous commits)
examples: 3rd-party sse (2):  add the same client-side as the original 3rd-party example
2021-01-27 04:51:53 +02:00

24 lines
638 B
HTML

<!DOCTYPE html>
<html>
<head>
<title>SSE Examples</title>
</head>
<body>
<strong>Messages</strong>
<br>
<div id="messages"></div>
<script type="text/javascript">
e1 = new EventSource('/events/channel-1');
e1.onmessage = function(event) {
document.getElementById('messages').innerHTML += 'Message on channel-1: ' + event.data + '<br>';
};
e2 = new EventSource('/events/channel-2');
e2.onmessage = function(event) {
document.getElementById('messages').innerHTML += 'Message on channel-2: ' + event.data + '<br>';
};
</script>
</body>
</html>