summaryrefslogtreecommitdiffstats
path: root/internal/handler/grpc
diff options
context:
space:
mode:
authorbndw <ben@bdw.to>2026-02-13 18:17:37 -0800
committerbndw <ben@bdw.to>2026-02-13 18:17:37 -0800
commit3481c3273f8764bd0a0ab51183dc57f592fb616c (patch)
tree8bef805f5f18420198a04bf87578bbc80b76ea40 /internal/handler/grpc
parentecd4a2240dd443fd6949e6e1120a7ec971a024ca (diff)
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!
Diffstat (limited to 'internal/handler/grpc')
-rw-r--r--internal/handler/grpc/server.go4
1 files changed, 4 insertions, 0 deletions
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 {
28 } 28 }
29} 29}
30 30
31func (s *Server) SetSubscriptionManager(mgr *subscription.Manager) {
32 s.subs = mgr
33}
34
31func (s *Server) PublishEvent(ctx context.Context, req *pb.PublishEventRequest) (*pb.PublishEventResponse, error) { 35func (s *Server) PublishEvent(ctx context.Context, req *pb.PublishEventRequest) (*pb.PublishEventResponse, error) {
32 if req.Event == nil { 36 if req.Event == nil {
33 return &pb.PublishEventResponse{ 37 return &pb.PublishEventResponse{