How to create simple group chat using js. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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

21st Oct 2022, 3:21 PM
KG YADAV
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.
21st Oct 2022, 9:10 PM
Roland
Roland - avatar
0
Good advice above. For group chat take a look at socket io rooms since you dont want to broadcast to everyone
22nd Oct 2022, 1:00 PM
Toni Isotalo
Toni Isotalo - avatar