mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-08-29 07:11:58 +02:00
support handling CLOSED messages from relay client.
This commit is contained in:
5
relay.go
5
relay.go
@@ -300,6 +300,10 @@ func (r *Relay) Connect(ctx context.Context) error {
|
||||
if subscription, ok := r.Subscriptions.Load(string(*env)); ok {
|
||||
subscription.dispatchEose()
|
||||
}
|
||||
case *ClosedEnvelope:
|
||||
if subscription, ok := r.Subscriptions.Load(string(env.SubscriptionID)); ok {
|
||||
subscription.dispatchClosed(env.Reason)
|
||||
}
|
||||
case *CountEnvelope:
|
||||
if subscription, ok := r.Subscriptions.Load(string(env.SubscriptionID)); ok && env.Count != nil && subscription.countResult != nil {
|
||||
subscription.countResult <- *env.Count
|
||||
@@ -478,6 +482,7 @@ func (r *Relay) PrepareSubscription(ctx context.Context, filters Filters, opts .
|
||||
counter: int(current),
|
||||
Events: make(chan *Event),
|
||||
EndOfStoredEvents: make(chan struct{}),
|
||||
ClosedReason: make(chan string, 1),
|
||||
Filters: filters,
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user