MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / Subscribe

Method Subscribe

internal/sessions/manager.go:304–314  ·  view source on GitHub ↗

Subscribe creates a channel that receives command results for a session.

(sessionID, subID string)

Source from the content-addressed store, hash-verified

302
303// Subscribe creates a channel that receives command results for a session.
304func (m *Manager) Subscribe(sessionID, subID string) <-chan *CommandResult {
305 sess := m.Get(sessionID)
306 if sess == nil {
307 return nil
308 }
309 ch := make(chan *CommandResult, subscriberChannelSize)
310 sess.mu.Lock()
311 defer sess.mu.Unlock()
312 sess.subscribers[subID] = ch
313 return ch
314}
315
316// Unsubscribe removes a subscriber and closes its channel.
317func (m *Manager) Unsubscribe(sessionID, subID string) {

Calls 1

GetMethod · 0.95