🐛 Fix websocket connection when no auth provider panic
This commit is contained in:
parent
a6212335e7
commit
fed972fc16
@ -26,12 +26,15 @@ func ClientRegister(user models.Account, conn *websocket.Conn) uint64 {
|
||||
wsConn[user.ID][clientId] = conn
|
||||
wsMutex.Unlock()
|
||||
|
||||
pc, err := directory.GetServiceInstanceByType(hyper.ServiceTypeAuthProvider).GetGrpcConn()
|
||||
if err == nil {
|
||||
proto.NewStreamControllerClient(pc).EmitStreamEvent(context.Background(), &proto.StreamEventRequest{
|
||||
Event: "ClientRegister",
|
||||
UserId: uint64(user.ID),
|
||||
})
|
||||
srv := directory.GetServiceInstanceByType(hyper.ServiceTypeAuthProvider)
|
||||
if srv != nil {
|
||||
pc, err := srv.GetGrpcConn()
|
||||
if err == nil {
|
||||
_, _ = proto.NewStreamControllerClient(pc).EmitStreamEvent(context.Background(), &proto.StreamEventRequest{
|
||||
Event: "ClientRegister",
|
||||
UserId: uint64(user.ID),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return clientId
|
||||
|
Loading…
Reference in New Issue
Block a user