From: Ian Jackson Date: Sun, 5 Jul 2020 12:09:54 +0000 (+0100) Subject: wip protocol X-Git-Tag: otter-0.2.0~1451 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=50e3e8ecb7e55ba364a038d0f5409781924c086a;p=otter.git wip protocol --- diff --git a/src/sse.rs b/src/sse.rs index f99fc601..19637ce3 100644 --- a/src/sse.rs +++ b/src/sse.rs @@ -86,12 +86,13 @@ impl Read for UpdateReader { if next.client == self.client { write!(buf, "event: recorded\n\ - data: foo\n\n")?; - serde_json::to_writer(&mut *buf, &RecordedConfirmation { + data: ")?; + serde_json::to_writer(&mut buf, &RecordedConfirmation { gen : next.gen, piece : next.piece, cseq : next.client_seq, })?; + write!(buf, "\n\n")?; } else { write!(buf, "id: {}\n\ data: {}\n\n", diff --git a/templates/script.js b/templates/script.js index 5d773212..0c5a25b9 100644 --- a/templates/script.js +++ b/templates/script.js @@ -198,10 +198,11 @@ function startup() { messages[k](j[k]); } es.addEventListener('commsworking', function(event) { - console.log('GOTDATA'); + console.log('GOTDATA', event); status_node.innerHTML = event.data; }); es.addEventListener('recorded', function(event) { +// var j = JSON.parse(event.data); xxx_recorded(); }); es.onerror = function(e) {