From 40df56985402a31695a9a3bb13319bd2a3276305 Mon Sep 17 00:00:00 2001 From: bndw Date: Sat, 14 Feb 2026 12:49:08 -0800 Subject: feat: track WebSocket subscriptions in metrics Add metrics tracking for WebSocket (NIP-01) subscriptions in addition to existing gRPC subscription tracking. Changes: - Add Count() method to subscription.Manager - Add MetricsRecorder interface to WebSocket handler - Update subscription metrics when REQ/CLOSE messages processed - Wire up metrics to WebSocket handler in main.go Before: Only gRPC stream subscriptions were counted After: Both gRPC and WebSocket subscriptions tracked accurately This fixes the dashboard showing 0 subscriptions when clients connect via WebSocket (e.g., nak req --stream). --- cmd/relay/main.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cmd') diff --git a/cmd/relay/main.go b/cmd/relay/main.go index 457a719..e4fe9bc 100644 --- a/cmd/relay/main.go +++ b/cmd/relay/main.go @@ -93,6 +93,9 @@ func main() { } wsHandler := wshandler.NewHandler(store, subManager) + if m != nil { + wsHandler.SetMetrics(m) + } var grpcDisplay, httpDisplay, wsDisplay string if cfg.Server.PublicURL != "" { -- cgit v1.2.3