Skip to content

Commit

Permalink
Improve chat example JavaScript code.
Browse files Browse the repository at this point in the history
Resolves #2617.
  • Loading branch information
SergioBenitez committed Sep 20, 2023
1 parent 26a3f00 commit 498af3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/chat/static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down

0 comments on commit 498af3d

Please sign in to comment.