Insired by TypeRacer
Uses socket.io to send client-to-server messages
npm startornode server.js- Browse to
localhost:9001/to serve a plain HTML file with socket.io clientside script that communicates with the node-server
- Every socket object has an
idand after the user joins the game we add ausername. - Messages from the server are passed globally with
io.emit("eventName", data)or to a single user with:io.to(socket.id).emit("eventName"), data)