UnsubscribeObserve removes an observer and closes its channel.
(sessionID, subID string)
| 363 | |
| 364 | // UnsubscribeObserve removes an observer and closes its channel. |
| 365 | func (m *Manager) UnsubscribeObserve(sessionID, subID string) { |
| 366 | sess := m.Get(sessionID) |
| 367 | if sess == nil { |
| 368 | return |
| 369 | } |
| 370 | sess.mu.Lock() |
| 371 | defer sess.mu.Unlock() |
| 372 | if ch, ok := sess.observers[subID]; ok { |
| 373 | close(ch) |
| 374 | delete(sess.observers, subID) |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | // PublishObserve sends an observe event to all observers of a session. |
| 379 | func (m *Manager) PublishObserve(sessionID string, event *ObserveEvent) { |
no test coverage detected