From 7327c3e200eeb09256085d52879ac2113a2b5c67 Mon Sep 17 00:00:00 2001 From: zeus Date: Sun, 28 Mar 2021 18:22:29 +0300 Subject: [PATCH] add example --- .../sec/project/courses/example-helloworld/app/server.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install/usr/share/swarmlab.io/sec/project/courses/example-helloworld/app/server.js b/install/usr/share/swarmlab.io/sec/project/courses/example-helloworld/app/server.js index 66f9c8b..f084d2c 100644 --- a/install/usr/share/swarmlab.io/sec/project/courses/example-helloworld/app/server.js +++ b/install/usr/share/swarmlab.io/sec/project/courses/example-helloworld/app/server.js @@ -4,17 +4,17 @@ var http = require('http').Server(app); var io = require('socket.io')(http); +app.get('/', (req, res) => { + res.send('

Hello world!

'); +}); + io.on('connection', s => { console.error('socket connection'); s.on('log', (data, room) => { - s.to('iot').emit('message', data); console.log('broadcast', data); - }); - //s.emit('message', 'message from server'); - });