1 <!DOCTYPE html> |
1 <!doctype html> |
2 <html> |
2 <html> |
3 <head> |
3 <head> |
4 <link rel="icon" href="data:;base64,="> |
4 <meta charset="utf-8"> |
5 <script type="text/javascript"> |
5 <meta name="viewport" content="width=device-width, initial-scale=1"> |
6 var sock = null; |
6 <title>Mons by IRI</title> |
7 var ellog = null; |
7 <link rel="stylesheet" href="{{ config['STATIC_URL'] }}/css/lib.css"> |
8 |
8 <link rel="stylesheet" href="{{ config['STATIC_URL'] }}/css/base.css"> |
9 window.onload = function() { |
9 </head> |
10 |
10 <body> |
11 ellog = document.getElementById('log'); |
11 <div class="container" id="index-container"> |
12 |
12 <h1 class="row">Évènements actifs :</h1> |
13 var wsuri; |
13 {% for event in events %} |
14 if (window.location.protocol === "file:") { |
14 <div class="row"> |
15 wsuri = "ws://127.0.0.1:8090/broadcast"; |
15 <div class="event-label"><a href="{{ url_for('page_annotationclient_event_code', event_code=event.code) }}">{{ event.label }}</a></div> |
16 } else { |
16 <dl> |
17 wsuri = "ws://" + window.location.hostname + ":8090/broadcast"; |
17 <dt>Code : {{ event.code }}</dt> |
18 } |
18 <dd>Description : {{ event.description }}</dd> |
19 if ("WebSocket" in window) { |
19 </dl> |
20 sock = new WebSocket(wsuri); |
20 </div> |
21 } else if ("MozWebSocket" in window) { |
21 {% endfor %} |
22 sock = new MozWebSocket(wsuri); |
22 </div> |
23 } else { |
23 </body> |
24 log("Browser does not support WebSocket!"); |
|
25 window.location = "http://autobahn.ws/unsupportedbrowser"; |
|
26 } |
|
27 |
|
28 if (sock) { |
|
29 sock.onopen = function() { |
|
30 log("Connected to " + wsuri); |
|
31 } |
|
32 |
|
33 sock.onclose = function(e) { |
|
34 log("Connection closed (wasClean = " + e.wasClean + ", code = " + e.code + ", reason = '" + e.reason + "')"); |
|
35 sock = null; |
|
36 } |
|
37 |
|
38 sock.onmessage = function(e) { |
|
39 log("Got message: " + e.data); |
|
40 } |
|
41 } |
|
42 }; |
|
43 |
|
44 function log(m) { |
|
45 ellog.innerHTML += m + '\n'; |
|
46 ellog.scrollTop = ellog.scrollHeight; |
|
47 }; |
|
48 </script> |
|
49 <link rel="stylesheet" type="text/css" href="/static/css/base.css"> |
|
50 </head> |
|
51 <body> |
|
52 <h1>OSC websocket Test</h1> |
|
53 <noscript>You must enable JavaScript</noscript> |
|
54 <pre id="log"></pre> |
|
55 </body> |
|
56 </html> |
|