res.sendFile(__dirname + '/index.html');
});
io.on('connection', (socket) => {
res.sendFile(__dirname + '/index.html');
});
io.on('connection', (socket) => {
- console.log("Connection from client with " + socket.request.session.views + " views.");
+ // First things first, tell the client their name (if any)
+ if (socket.request.session.name) {
+ socket.emit('inform-name', socket.request.session.name);
+ }
// When any client comments, send that to all clients (including sender)
socket.on('comment', (comment) => {
io.emit('comment', comment);
// When any client comments, send that to all clients (including sender)
socket.on('comment', (comment) => {
io.emit('comment', comment);