Commit 0eb28323 authored by dns2utf8's avatar dns2utf8

Display all messages

parent 2ef03410
......@@ -137,7 +137,7 @@ impl StreamHandler<ws::Message, ws::ProtocolError> for Ws {
self.hub.send(message)
.into_actor(self)
.then(|response, this, ctx| {
let response: ClientResponse = response.unwrap();
let response: ClientResponse = response.expect("error processing ClientRequest");
actix::Handler::handle(this, response, ctx);
fut::ok( () )
})
......
......@@ -2,13 +2,15 @@
const log = console.log
, error = console.error;
let html_logger = undefined;
let html_logger = _ => {};
let ws = undefined;
let galleries = [], galleries_element = undefined;
setup_ws();
WebSocket.prototype.send_object = function(obj) {
return this.send(JSON.stringify(obj));
const str = JSON.stringify(obj);
html_logger('> ' + str);
return this.send(str);
}
window.addEventListener('load', function() {
......@@ -33,7 +35,7 @@ function update_ui() {
const text = document.createElement('div');
title.innerHTML = x.name || `unnamed Gallery #${x.id}`;
text.innerHTML = 'loading tree...';
text.innerHTML = 'TODO loading tree...';
div.appendChild(title);
div.appendChild(text);
......@@ -55,7 +57,8 @@ function setup_test_websocket() {
log(entry);
html_logger(entry);
ws.send('"bla"')
ws.send('{"ClientRequest":"ListAllPods"}');
ws.send('{"ClientRequest":{"ListPodStructure":2}}');
});
}
......
......@@ -79,7 +79,7 @@ function registerSelf() {
function publishPictures() {
if (Pod.connected) {
const paths = Pod.shared_files.reduce((b, cur) => { b.push(cur.name); return b }, []);
ws.send_object({"PodRequest":{"UpdatePaths":{"paths":paths}}});
ws.send_object({"PodRequest": {"UpdatePaths": { "paths": paths } } });
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment