mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 18:51:03 +01:00
61f04ee4ff
examples: 3rd-party sse (2): add the same client-side as the original 3rd-party example
24 lines
638 B
HTML
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>
|