-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathClientBIT.html
32 lines (28 loc) · 1.04 KB
/
ClientBIT.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
<html>
<script language="javascript" type="text/javascript" src="static/jquery.js"></script>
<script language="javascript" type="text/javascript" src="static/jquery.flot.js"></script>
<script type="text/javascript">
// Establish a connection to the ServerBIT
var ws = new WebSocket("ws://localhost:8000/");
ws.onopen = function() {
};
// Process the responses sent by the ServerBIT
ws.onmessage = function (e) {
data = JSON.parse(e.data)
var d1 = [];
ch = 'A1'
for (var i = 0; i < data[ch].length; i += 1)
d1.push([i, data[ch][i]]);
$.plot($("#placeholder"), [ d1 ], {yaxis: {min:0, max: 1024}});
};
// Detect when the page is unloaded or close
window.onbeforeunload = function() {
ws.onclose = function () {};
ws.close()
};
</script>
<body>
<div><h1>BITalinoWS</h1></div>
<div id="placeholder" style="width:600px;height:300px;"></div>
</body>
</html>