Notify notifies the clients with the given userID that a new messages was created.
(userID uint, msg *model.MessageExternal)
| 81 | |
| 82 | // Notify notifies the clients with the given userID that a new messages was created. |
| 83 | func (a *API) Notify(userID uint, msg *model.MessageExternal) { |
| 84 | a.lock.RLock() |
| 85 | defer a.lock.RUnlock() |
| 86 | if clients, ok := a.clients[userID]; ok { |
| 87 | for _, c := range clients { |
| 88 | c.write <- msg |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | func (a *API) remove(remove *client) { |
| 94 | a.lock.Lock() |
nothing calls this directly
no outgoing calls
no test coverage detected