-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdemo.html
36 lines (30 loc) · 1.37 KB
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>sc-item Demo</title>
<script src="../webcomponentsjs/webcomponents.min.js"></script>
<link rel="import" href="sc-sse.html">
</head>
<body unresolved>
<span>See console messages<br>
Start the generator of issues: https://github.com/siscomando/webapp/blob/master/src/websse.py
</span>
<sc-sse stream="http://localhost:8080/stream" channel="userlogon" alias="updates"></sc-sse>
<script>
var sse = document.querySelector('sc-sse');
sse.addEventListener('sc-sse-response', function(e) {
// channel is useful when to receives from one URL stream
// that returns differents data as users, comments or issues
// updates where theses are implemented in server side.
console.log("Reply from channel[" + channel "]: " + e.detail.response);
// alias is useful when multiple sc-sse in same page.
// alias it's a name for the data returned by sc-sse
// custom element.
if (e.detail.alias == "updates") {
console.log("Returned data from updates sc-sse");
}
});
</script>
</body>
</html>