From 3481c3273f8764bd0a0ab51183dc57f592fb616c Mon Sep 17 00:00:00 2001 From: bndw Date: Fri, 13 Feb 2026 18:17:37 -0800 Subject: feat: add WebSocket server with full NIP-01 support WebSocket handler: - NIP-01 protocol (EVENT, REQ, CLOSE, OK, EOSE, NOTICE) - JSON envelope parsing - Shares subscription manager with gRPC (unified event fan-out) - Standard Nostr client compatibility Relay now serves dual protocols: - gRPC on :50051 (binary, high performance) - WebSocket on :8080 (JSON, Nostr standard) Both protocols share: - Same storage layer - Same subscription manager - Same validation logic Compatible with all Nostr clients! --- internal/handler/grpc/server.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'internal/handler/grpc') diff --git a/internal/handler/grpc/server.go b/internal/handler/grpc/server.go index 74857f6..b65b527 100644 --- a/internal/handler/grpc/server.go +++ b/internal/handler/grpc/server.go @@ -28,6 +28,10 @@ func NewServer(store EventStore) *Server { } } +func (s *Server) SetSubscriptionManager(mgr *subscription.Manager) { + s.subs = mgr +} + func (s *Server) PublishEvent(ctx context.Context, req *pb.PublishEventRequest) (*pb.PublishEventResponse, error) { if req.Event == nil { return &pb.PublishEventResponse{ -- cgit v1.2.3