node-go/server/socket.js

20 lines
479 B
JavaScript
Raw Permalink Normal View History

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