fix(cli): ignore web socket when unavailable and skip metadata init (#4748)

This commit is contained in:
Jason Rasmussen
2023-10-31 23:08:21 -04:00
committed by GitHub
parent 197f336b5f
commit 68f6446718
3 changed files with 14 additions and 4 deletions

View File

@@ -10,7 +10,7 @@ export class CommunicationRepository implements OnGatewayConnection, OnGatewayDi
constructor(private authService: AuthService) {}
@WebSocketServer() server!: Server;
@WebSocketServer() server?: Server;
addEventListener(event: 'connect', callback: Callback) {
this.onConnectCallbacks.push(callback);
@@ -37,10 +37,10 @@ export class CommunicationRepository implements OnGatewayConnection, OnGatewayDi
}
send(event: CommunicationEvent, userId: string, data: any) {
this.server.to(userId).emit(event, data);
this.server?.to(userId).emit(event, data);
}
broadcast(event: CommunicationEvent, data: any) {
this.server.emit(event, data);
this.server?.emit(event, data);
}
}