Files
pcpuma_unam_api/src/app.gateway.ts
T

52 lines
1.3 KiB
TypeScript
Raw Normal View History

2022-05-03 12:35:16 -05:00
import {
WebSocketGateway,
OnGatewayInit,
WebSocketServer,
OnGatewayConnection,
OnGatewayDisconnect,
} from '@nestjs/websockets';
import { Socket, Server } from 'socket.io';
@WebSocketGateway({
cors: {
2022-08-07 21:03:01 -05:00
origin: [
2022-09-06 23:22:38 -05:00
'http://localhost:3176',
2022-09-05 11:50:22 -05:00
// 'http://localhost:3186',
2022-08-12 19:34:07 -05:00
// 'http://132.248.80.196:3155',
// 'http://132.248.80.196:3185',
2022-09-05 11:50:22 -05:00
'https://pmodulospcpuma.unam.mx',
'https://pmodulospcpuma.unam.mx:3015',
2022-09-02 11:10:13 -05:00
// 'https://modulospcpuma.unam.mx',
// 'https://modulospcpuma.unam.mx:3015',
// 'https://betelgeuse.acatlan.unam.mx:3180',
2022-08-07 21:03:01 -05:00
],
2022-05-03 12:35:16 -05:00
},
})
export class AppGateway
implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect
{
@WebSocketServer() server: Server;
2022-06-16 19:18:00 -05:00
actualizarUsuario(id_usuario: number) {
this.server.emit('actualizar-usuario', { id_usuario });
2022-05-03 12:35:16 -05:00
}
2022-06-16 19:18:00 -05:00
actualizarOperador(id_institucion: number) {
this.server.emit('actualizar-operador', { id_institucion });
2022-05-03 12:35:16 -05:00
}
2022-08-12 15:42:18 -05:00
equiposNuevos(id_institucion: number, data) {
this.server.emit('equipos-nuevos', { id_institucion, data });
2022-08-12 11:52:10 -05:00
}
usuariosNuevos(id_institucion: number, data) {
this.server.emit('usuarios-nuevos', { id_institucion, data });
}
2022-06-16 19:18:00 -05:00
afterInit(server: Server) {}
handleConnection(client: Socket, ...args: any[]) {}
handleDisconnect(client: Socket) {}
2022-05-03 12:35:16 -05:00
}