Get reports through to the browser.
This commit is contained in:
@@ -139,6 +139,7 @@ class HTTPRequestHandler(object):
|
|||||||
_MIME_TYPES = {
|
_MIME_TYPES = {
|
||||||
'.html': 'text/html',
|
'.html': 'text/html',
|
||||||
'.iso': 'application/octet-stream',
|
'.iso': 'application/octet-stream',
|
||||||
|
'.js': 'application/javascript',
|
||||||
'.json': 'application/json',
|
'.json': 'application/json',
|
||||||
}
|
}
|
||||||
_BLOCK_SIZE = 2 ** 16
|
_BLOCK_SIZE = 2 ** 16
|
||||||
@@ -150,10 +151,14 @@ class HTTPRequestHandler(object):
|
|||||||
self._image_types = image_types
|
self._image_types = image_types
|
||||||
|
|
||||||
slave_ws_handler = GetSlaveWSHandler(image_types, websockets)
|
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)
|
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):
|
def __call__(self, env, start_response):
|
||||||
path = env['PATH_INFO']
|
path = env['PATH_INFO']
|
||||||
|
|||||||
9
server/static/control.js
Normal file
9
server/static/control.js
Normal 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);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1 +1,7 @@
|
|||||||
test
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="/static/control.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user