25 lines
560 B
JavaScript
25 lines
560 B
JavaScript
const { Server } = require('socket.io');
|
|
let io;
|
|
|
|
module.exports = {
|
|
init(httpServer) {
|
|
io = new Server(httpServer, {
|
|
cors: {
|
|
origin: [
|
|
// 'http://localhost:3046',
|
|
// 'http://localhost:3056',
|
|
// 'http://132.248.80.196:3045',
|
|
// 'http://132.248.80.196:3055',
|
|
'https://pcpuma.acatlan.unam.mx',
|
|
'https://pcpuma.acatlan.unam.mx:8080',
|
|
],
|
|
},
|
|
});
|
|
return io;
|
|
},
|
|
getIO() {
|
|
if (!io) throw new Error('Socket.io no se ha inicializado.');
|
|
return io;
|
|
},
|
|
};
|