From 498af3d9d0d2c47dbd1ae5579f64c4be362e1d10 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Wed, 20 Sep 2023 13:55:59 -0700 Subject: [PATCH] Improve chat example JavaScript code. Resolves #2617. --- examples/chat/static/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chat/static/script.js b/examples/chat/static/script.js index d78e3e6a..99e0fef2 100644 --- a/examples/chat/static/script.js +++ b/examples/chat/static/script.js @@ -94,7 +94,7 @@ function subscribe(uri) { console.log("raw data", JSON.stringify(ev.data)); console.log("decoded data", JSON.stringify(JSON.parse(ev.data))); const msg = JSON.parse(ev.data); - if (!"message" in msg || !"room" in msg || !"username" in msg) return; + if (!("message" in msg) || !("room" in msg) || !("username" in msg)) return; addMessage(msg.room, msg.username, msg.message, true); });