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.
40 lines
920 B
40 lines
920 B
|
|
var fs = require( 'fs' );
|
|
var app = require('express')();
|
|
var https = require('https');
|
|
var server = https.createServer({
|
|
key: fs.readFileSync('./llo/swarmlab.key'),
|
|
cert: fs.readFileSync('./llo/swarmlab.crt'),
|
|
//ca: fs.readFileSync('./test_ca.crt'),
|
|
requestCert: false,
|
|
rejectUnauthorized: false
|
|
},app);
|
|
|
|
|
|
server.listen(3000, () => console.error('listening on https://localhost:3000/'));
|
|
var io = require('socket.io').listen(server);
|
|
console.error('socket.io example');
|
|
|
|
|
|
|
|
io.on('connection', s => {
|
|
if( typeof s !== "undefined" ){
|
|
console.error('socket connection');
|
|
}
|
|
|
|
s.on('actionstart', obj => {
|
|
console.error('fromclient '+obj);
|
|
socket.emit("log", obj)
|
|
});
|
|
/*
|
|
s.on('s1', function(room) {
|
|
console.log('leaving room', room);
|
|
})
|
|
*/
|
|
s.on('s1', () => {
|
|
console.log('hi from server');
|
|
}); // listen to the event
|
|
|
|
|
|
});
|
|
|
|
|