listo socket

This commit is contained in:
xXpuma99Xx
2022-01-25 22:08:13 -06:00
parent e8f9a96ecf
commit 833dc127be
12 changed files with 81 additions and 115 deletions
+22
View File
@@ -0,0 +1,22 @@
const { Server } = require('socket.io');
let io;
module.exports = {
init(httpServer) {
io = new Server(httpServer, {
cors: {
origin: [
'http://localhost:3046',
'http://localhost:3056',
// '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;
},
};