43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import {
|
|
WebSocketGateway,
|
|
OnGatewayInit,
|
|
WebSocketServer,
|
|
OnGatewayConnection,
|
|
OnGatewayDisconnect,
|
|
} from '@nestjs/websockets';
|
|
import { Socket, Server } from 'socket.io';
|
|
|
|
@WebSocketGateway({
|
|
cors: {
|
|
origin: [
|
|
// 'http://localhost:3176',
|
|
// 'http://localhost:3186',
|
|
'http://132.248.80.196:3155',
|
|
'http://132.248.80.196:3185',
|
|
// 'https://pmodulospcpuma.unam.mx',
|
|
// 'http://pmodulospcpuma.unam.mx:3015/',
|
|
// 'https://modulospcpuma.unam.mx',
|
|
// 'https://modulospcpuma.unam.mx:3015/',
|
|
],
|
|
},
|
|
})
|
|
export class AppGateway
|
|
implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect
|
|
{
|
|
@WebSocketServer() server: Server;
|
|
|
|
actualizarUsuario(id_usuario: number) {
|
|
this.server.emit('actualizar-usuario', { id_usuario });
|
|
}
|
|
|
|
actualizarOperador(id_institucion: number) {
|
|
this.server.emit('actualizar-operador', { id_institucion });
|
|
}
|
|
|
|
afterInit(server: Server) {}
|
|
|
|
handleConnection(client: Socket, ...args: any[]) {}
|
|
|
|
handleDisconnect(client: Socket) {}
|
|
}
|