2020-01-08 19:24:24 +00:00
|
|
|
// TODO const someSocketLogic = require('./middleware/socketssockets/...');
|
2020-01-21 22:33:40 +00:00
|
|
|
const socketIO = require('socket.io');
|
|
|
|
const io = socketIO({ cookie: false });
|
2020-01-08 19:24:24 +00:00
|
|
|
|
2020-01-21 22:33:40 +00:00
|
|
|
io.on('connection', ()=> {
|
|
|
|
io.emit('connected', {message: 'socket connected'});
|
|
|
|
})
|
2020-01-08 19:24:24 +00:00
|
|
|
|
2020-01-21 22:33:40 +00:00
|
|
|
enableRoomSocket = (roomId) => {
|
|
|
|
const roomSocket = io.of(roomId);
|
|
|
|
roomSocket.on('connection', () => {
|
|
|
|
console.log(`Socket connected at room ${roomId}`);
|
|
|
|
});
|
|
|
|
return roomSocket;
|
|
|
|
}
|
2020-01-08 19:24:24 +00:00
|
|
|
|
2020-01-21 22:33:40 +00:00
|
|
|
module.exports = {
|
|
|
|
io,
|
|
|
|
enableRoomSocket
|
2020-01-08 07:17:10 +00:00
|
|
|
}
|