My friend and I are currently working on creating a chat room for students at our school to use in their free time. We wanted to make sure the chat remains safe for work, so I attempted to add a filter. However, once the filter was added, no messages could be sent in the chat. When I turned off the filter script by commenting it out, the messages were able to go through without any issues.
This is the filter code that caused the issue:
var array = array.js
message.replace(array, "****");
Below is the messaging code being used:
if (message && connected) {
$inputMessage.val("");
addChatMessage({
username: username,
message: message
});
socket.emit("new message", message);
}}
My friend is more experienced with JavaScript and is responsible for the Messaging code, but due to his busy schedule, I am attempting to troubleshoot the issue on my own for now.