🔊 Log when pushing websocket package

This commit is contained in:
LittleSheep 2024-11-17 17:38:14 +08:00
parent c0edeec621
commit ab9bc5d127
2 changed files with 7 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"git.solsynth.dev/hypernet/nexus/pkg/internal/http/ws" "git.solsynth.dev/hypernet/nexus/pkg/internal/http/ws"
"github.com/rs/zerolog/log"
"git.solsynth.dev/hypernet/nexus/pkg/proto" "git.solsynth.dev/hypernet/nexus/pkg/proto"
"github.com/samber/lo" "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") 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 { if len(errs) > 0 {
// Partial fail // Partial fail
return &proto.PushStreamResponse{ return &proto.PushStreamResponse{

View File

@ -39,7 +39,7 @@ func ClientUnregister(user sec.UserInfo, id uint64) {
delete(wsConn[user.ID], id) delete(wsConn[user.ID], id)
wsMutex.Unlock() wsMutex.Unlock()
directory.BroadcastEvent("ws.client.unregister", map[string]any{ _ = directory.BroadcastEvent("ws.client.unregister", map[string]any{
"user": user.ID, "user": user.ID,
"id": id, "id": id,
}) })