Building a Real-time Chat Application Using Strapi, Next,, and PostgreSQL

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 grants us this privilege.

This is a companion discussion topic for the original entry at

Refer the below mentioned link to setup postgres through command for Macbook M1.

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?

Thanks in advance