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.
 
 
 
 
 
 

29 lines
573 B

var path = require('path');
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
/*
// server side code
io.sockets.on('connection', function(socket) {
socket.on('create', function(room) {
socket.join(room);
});
});
*/
io.on('connection', s => {
s.on("iot", function (room) {
s.join(room);
console.error('hi');
s.to(room).emit('message', 'hi from server');
io.emit('iotdata', 'hi from server');
});
});
http.listen(8084, () => console.error('listening on http://localhost:8084/'));