From 97a746c5729f4031ded987d392c67b5e4f017ee1 Mon Sep 17 00:00:00 2001 From: Maciek Nowacki Date: Fri, 12 Mar 2021 11:08:19 -0700 Subject: [PATCH] don't double-encode JSON --- src/xhrListener.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xhrListener.ts b/src/xhrListener.ts index 39617e7..2322e98 100644 --- a/src/xhrListener.ts +++ b/src/xhrListener.ts @@ -79,10 +79,10 @@ class XhrListener { for (let client of c.clients) { let nonce: string = crypto.randomBytes(4).toString("hex"); // TODO: verify the nonce against the received reply, which we currently ignore - client.directMessage(JSON.stringify({ + client.directMessage({ message_type: "broadcast", message: { event_type: event, seq_id: nonce, examId: archMsg.examId } - })); + }); dmCount++; } // dmCount of 1 would be normal. more than 1 is odd, but not necessarily bad. 0 means Exam UI has gone away somehow.