New course! Every coder should learn Generative AI!
Try a free lesson0
How to create simple group chat using js.
Using socket io when starting ask name and refer to chat page after clicking and display message to all who join
2 Answers
+ 2
You have to learn web socket events.
Socket.io => https://socket.io/docs/v4/
You have to create a node.js server with socket.io library and a front-end client with socket.io too.
On server/client connection, open a New web socket to communicate with each other.
You can create a event, in server or in client to send a message and execute something. You Can also broadcast messages to all clients connected.
0
Good advice above.
For group chat take a look at socket io rooms since you dont want to broadcast to everyone