From ab9bc5d127c88a9da295a147d11da4de8eaabc53 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 17 Nov 2024 17:38:14 +0800 Subject: [PATCH] :loud_sound: Log when pushing websocket package --- pkg/internal/grpc/stream.go | 6 ++++++ pkg/internal/http/ws/connections.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/internal/grpc/stream.go b/pkg/internal/grpc/stream.go index 3b5ffea..5e14430 100644 --- a/pkg/internal/grpc/stream.go +++ b/pkg/internal/grpc/stream.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "git.solsynth.dev/hypernet/nexus/pkg/internal/http/ws" + "github.com/rs/zerolog/log" "git.solsynth.dev/hypernet/nexus/pkg/proto" "github.com/samber/lo" @@ -28,6 +29,11 @@ func (v *Server) PushStream(ctx context.Context, request *proto.PushStreamReques return nil, fmt.Errorf("you must give one of the user id or client id") } + log.Debug(). + Uint64("client_id", request.GetClientId()). + Uint64("user_id", request.GetUserId()). + Msgf("Pushing a websocket package to client / user...") + if len(errs) > 0 { // Partial fail return &proto.PushStreamResponse{ diff --git a/pkg/internal/http/ws/connections.go b/pkg/internal/http/ws/connections.go index b544915..5536bf8 100644 --- a/pkg/internal/http/ws/connections.go +++ b/pkg/internal/http/ws/connections.go @@ -39,7 +39,7 @@ func ClientUnregister(user sec.UserInfo, id uint64) { delete(wsConn[user.ID], id) wsMutex.Unlock() - directory.BroadcastEvent("ws.client.unregister", map[string]any{ + _ = directory.BroadcastEvent("ws.client.unregister", map[string]any{ "user": user.ID, "id": id, })