2022-01-25 22:08:13 -06:00
|
|
|
const { Server } = require('socket.io');
|
|
|
|
|
let io;
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
init(httpServer) {
|
|
|
|
|
io = new Server(httpServer, {
|
|
|
|
|
cors: {
|
|
|
|
|
origin: [
|
2022-03-22 11:42:41 -06:00
|
|
|
// 'http://localhost:3046',
|
|
|
|
|
// 'http://localhost:3056',
|
2022-05-24 10:57:28 -05:00
|
|
|
'http://132.248.80.196:3045',
|
|
|
|
|
'http://132.248.80.196:3055',
|
|
|
|
|
// 'https://pcpuma.acatlan.unam.mx',
|
|
|
|
|
// 'https://pcpuma.acatlan.unam.mx:8080',
|
2022-01-25 22:08:13 -06:00
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
return io;
|
|
|
|
|
},
|
|
|
|
|
getIO() {
|
2022-02-08 17:40:01 -06:00
|
|
|
if (!io) throw new Error('Socket.io no se ha inicializado.');
|
2022-01-25 22:08:13 -06:00
|
|
|
return io;
|
|
|
|
|
},
|
|
|
|
|
};
|