master
louisa 2 years ago
parent bcd89ee98c
commit 0b9c15decb

@ -35,15 +35,16 @@ var io = require('socket.io')(server);
socket.on("blink", () => { socket.on("blink", () => {
console.log("Blink event received!"); console.log("Blink event received!");
io.emit("blink");
}); });
socket.on("message", (message) => { // socket.on("message", (message) => {
console.log("Received message:", message); // console.log("Received message:", message);
if (message === "blink") { // if (message === "blink") {
console.log("Blink event received!"); // console.log("Blink event received!");
io.emit("blink"); // Trigger the blink event to all connected clients // io.emit("blink"); // Trigger the blink event to all connected clients
} // }
}); // });
socket.on('chat message', (msg) => { socket.on('chat message', (msg) => {
console.log('[user]['+ socket.id + '][' + msg + ']'); console.log('[user]['+ socket.id + '][' + msg + ']');

@ -38,7 +38,6 @@
const message = inputField.value; const message = inputField.value;
if (message === 'BLINK') { if (message === 'BLINK') {
socket.emit('blink', message);
socket.emit('blink'); socket.emit('blink');
console.log('socket: blink'); console.log('socket: blink');
} }

Loading…
Cancel
Save