A simple WebSocket server built with the ws library that broadcasts messages to all connected clients in real time.
The server listens on ws://localhost:8080. When a client connects and sends a message, the server broadcasts it to every connected client (including the sender) prefixed with Server Broadcast:.
npm run devThis uses node --watch server.js which auto-restarts the server on file changes.
Install wscat globally if you don't have it:
npm install -g wscatConnect to the server:
wscat -c ws://localhost:8080Once connected, type a message and press Enter. Every connected client will see the broadcasted message in real time. Open multiple terminals with wscat to see multi-client messaging live.