Get reports through to the browser.

This commit is contained in:
Ian Gulliver
2016-05-05 00:33:30 +00:00
parent 5f19a48872
commit 6f0b747283
3 changed files with 23 additions and 3 deletions

View File

@@ -139,6 +139,7 @@ class HTTPRequestHandler(object):
_MIME_TYPES = {
'.html': 'text/html',
'.iso': 'application/octet-stream',
'.js': 'application/javascript',
'.json': 'application/json',
}
_BLOCK_SIZE = 2 ** 16
@@ -150,10 +151,14 @@ class HTTPRequestHandler(object):
self._image_types = image_types
slave_ws_handler = GetSlaveWSHandler(image_types, websockets)
self._slave_ws_handler = wsgiutils.WebSocketWSGIApplication(handler_cls=slave_ws_handler)
self._slave_ws_handler = wsgiutils.WebSocketWSGIApplication(
protocols=['iconograph-slave'],
handler_cls=slave_ws_handler)
master_ws_handler = GetMasterWSHandler(image_types, websockets)
self._master_ws_handler = wsgiutils.WebSocketWSGIApplication(handler_cls=master_ws_handler)
self._master_ws_handler = wsgiutils.WebSocketWSGIApplication(
protocols=['iconograph-master'],
handler_cls=master_ws_handler)
def __call__(self, env, start_response):
path = env['PATH_INFO']

9
server/static/control.js Normal file
View File

@@ -0,0 +1,9 @@
"use strict";
document.addEventListener('DOMContentLoaded', (e) => {
let ws = new WebSocket('wss://' + location.host + '/ws/master', 'iconograph-master');
ws.addEventListener('message', (e) => {
let parsed = JSON.parse(e.data);
console.log(parsed);
});
});

View File

@@ -1 +1,7 @@
test
<html>
<head>
<script src="/static/control.js"></script>
</head>
<body>
</body>
</html>