node-go/packages/play-node-go/server/socket.js
2020-02-05 16:44:34 -08:00

20 lines
No EOL
479 B
JavaScript

// 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
}