node server.js
localhost:5000
localhost:5000/?id=r_xxxxxxxxx
1. index.html: contains the main view for the project. html / css
2. server.js: essentially the backend for the project
3. client.js: client side actions. emits and recieves messages to the server.
socket.emit('custom_message', data);
socket.on('custom_message', function(data) {
// send back to everyone
// if we have rooms, only send to the proper room
io.emit('custom_message', data);
});
socket.on('custom_message', function(data) {
// handle the data
});
So the client sends a message, server processes it, and then sends it back to ALL CLIENTS