Sending and receiving text messages in recent times are frequently done online and in real-time. Text messages in real-time chat applications are sent and received immediately, depending on the speed of the router. Realtime messaging is very essential in chat applications, and Socket.io grants us this privilege.
I have a question, Is it effective to store online userId and socketId in the database, and also is it effective to store messages in the database directly and emit an event after the message has been saved?
I mean if there are so many users, how will we handle it if everyone sends messages at the same time and we save it directly to the database?