I'm not talking about the general application of the chat, but specifically about the implementation in the chat.
So in node.js / socket.io I was thinking of two approaches
Create an array for each chat, broadcast message to all users in the array
The transmission of all messages to all users on client computers determines whether they belong in the chat, if so, accept this message.
The weakness in 1 is that in the end, when scaling, you flood the server memory with arrays, and I use only about 80 MB on my hosting.
The weakness in 2 is that broadcasting to everyone will be costly, and flooding customers' cars will not make them happy.
I am sure that there are more effective approaches to how to implement chat, so I ask you guys to help me. First, I look for performance on the server side, and then on the client side, and it should be scalable.
Derek source
share