From c8f367092e7e1e57d02e8d69e9cf768fb28a73ab Mon Sep 17 00:00:00 2001 From: louisa Date: Wed, 14 Jun 2023 19:33:22 +0200 Subject: [PATCH] node data detalis --- app.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app.js b/app.js index 58617b6..ea35cb3 100644 --- a/app.js +++ b/app.js @@ -22,19 +22,18 @@ app.use(express.static(path.join(__dirname, "public"))); var io = require('socket.io')(server); -io.on('connection', function(socket){ + + io.on('connection', function(socket){ parser.on('data', function(data) { const msg = data.split(' '); console.log(msg[0], msg[1]); - io.emit(msg[0], msg[1]); + io.emit('node-data', data); }); console.log('Node.js is listening!!'); - socket.on("hello", (arg, callback) => { - console.log("hellohelo"); // "world" - io.emit('world'); - + socket.on("blink", (arg, callback) => { + io.emit('blink'); }); socket.on('chat message', (msg) => {