mirror of
https://github.com/aljazceru/khatru.git
synced 2026-02-01 11:14:20 +01:00
add OnDisconnect() handlers.
This commit is contained in:
@@ -61,6 +61,10 @@ func (rl *Relay) HandleWebsocket(w http.ResponseWriter, r *http.Request) {
|
||||
)
|
||||
|
||||
kill := func() {
|
||||
for _, ondisconnect := range rl.OnDisconnect {
|
||||
ondisconnect(ctx)
|
||||
}
|
||||
|
||||
ticker.Stop()
|
||||
cancel()
|
||||
if _, ok := rl.clients.Load(conn); ok {
|
||||
|
||||
1
relay.go
1
relay.go
@@ -56,6 +56,7 @@ type Relay struct {
|
||||
CountEvents []func(ctx context.Context, filter nostr.Filter) (int64, error)
|
||||
OnAuth []func(ctx context.Context, pubkey string)
|
||||
OnConnect []func(ctx context.Context)
|
||||
OnDisconnect []func(ctx context.Context)
|
||||
OnEventSaved []func(ctx context.Context, event *nostr.Event)
|
||||
|
||||
// editing info will affect
|
||||
|
||||
Reference in New Issue
Block a user