You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

24 lines
501 B

var path = require('path');
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
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');
});
http.listen(8084, () => console.error('listening on http://localhost:8084/'));
console.error('socket.io example');