-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
On the decision of eventually avoiding the bloating of a project by using socket.io I came across your YouTube channel. Surprisingly if you send some 20 messages in one room on the first browser the second browser with a different user in the same room crashes and only receives max up to twelve messages (tested with FF, Chrome, Chromium, Edge).
https://github.com/deniercounter/Realtime-Chat-Application/tree/18-08-2021/show-browser-crashing
I only changed client/containers/Messages.tsx -> handleSendMessage() in order to test it faster.
function handleSendMessage() {
const date = new Date();
numberOfSentMessages.current++;
newMessageRef.current.value = `${
numberOfSentMessages.current
}. Message from ${username} @ ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}:${date.getMilliseconds()}`;
const message = newMessageRef.current.value;
if (!String(message).trim()) {
return;
}
socket.emit(EVENTS.CLIENT.SEND_ROOM_MESSAGE, { roomId, message, username });
setMessages([
...messages,
{
username: "You",
message,
time: `${date.getHours()}:${date.getMinutes()}`,
},
]);
newMessageRef.current.value = `Here is ${username} (This msg will be replaced onClick SEND Button...)`;
}
Metadata
Metadata
Assignees
Labels
No labels