DEV Community

Discussion on: How to create a simple and beautiful chat with MongoDB, Express, React and Node.js (MERN stack)

Collapse
 
jeffsoriano profile image
Jeff Soriano

Can you please explain why you use socket.broadcast.emit for your 'push' event? It seems like socket.emit would work just fine but it doesn't. I've read this cheat sheet and it doesn't seem to explain why it wouldn't work:

socket.io/docs/v3/emit-cheatsheet/...

Collapse
 
armelpingault profile image
Armel

Hi Jeff, you might be right, I didn't test it with socket.emit, but it could be a mistake on my side ;)