Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

Commit

Permalink
Fixed bug with join/leave
Browse files Browse the repository at this point in the history
  • Loading branch information
FusionSid committed Jul 26, 2022
1 parent 4b3f875 commit 5da958a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/scripts/html_js/chatroom.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ function start(access_token) {
// On Events
if (msg["event"] === "User Disconnect") {
user = JSON.parse(msg["user"]);
var what_happened = `${user["username"]} left the chat`;
var what_happened = document.createTextNode(`${user["username"]} left the chat`);;
message_content_span.style.color = "red";
message_content_span.appendChild(what_happened);
}
if (msg["event"] === "User Join") {
user = JSON.parse(msg["user"]);
var what_happened = `${user["username"]} joined the chat`;
var what_happened = document.createTextNode(`${user["username"]} joined the chat`)
message_content_span.style.color = "red";
message_content_span.appendChild(what_happened);
}
} else {
// On normal message:
Expand Down

0 comments on commit 5da958a

Please sign in to comment.