MCPcopy
hub / github.com/gotify/server / NotifyDeletedClient

Method NotifyDeletedClient

api/stream/stream.go:67–80  ·  view source on GitHub ↗

NotifyDeletedClient closes existing connections with the given token.

(userID uint, token string)

Source from the content-addressed store, hash-verified

65
66// NotifyDeletedClient closes existing connections with the given token.
67func (a *API) NotifyDeletedClient(userID uint, token string) {
68 a.lock.Lock()
69 defer a.lock.Unlock()
70 if clients, ok := a.clients[userID]; ok {
71 for i := len(clients) - 1; i >= 0; i-- {
72 client := clients[i]
73 if client.token == token {
74 client.Close()
75 clients = append(clients[:i], clients[i+1:]...)
76 }
77 }
78 a.clients[userID] = clients
79 }
80}
81
82// Notify notifies the clients with the given userID that a new messages was created.
83func (a *API) Notify(userID uint, msg *model.MessageExternal) {

Calls 1

CloseMethod · 0.45

Tested by 2