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.
18 lines
511 B
18 lines
511 B
7 years ago
|
|
||
|
const express = require('express');
|
||
|
const app = express();
|
||
|
const http = require('http').Server(app);
|
||
|
const io = require('socket.io')(http);
|
||
|
const port = process.env.PORT || 3000;
|
||
|
|
||
|
app.use(express.static(__dirname + '/public'));
|
||
|
|
||
|
function onConnection(socket){
|
||
|
socket.on('key', (data) => socket.broadcast.emit('key', data));
|
||
|
socket.on('slidesLen', (data) => socket.broadcast.emit('slidesLen', data));
|
||
|
}
|
||
|
|
||
|
io.on('connection', onConnection);
|
||
|
|
||
|
http.listen(port, () => console.log('listening on port ' + port));
|