MCPcopy Create free account
hub / github.com/Tong89/smartNode / subscribe

Method subscribe

backend/stream.py:33–38  ·  view source on GitHub ↗

Register a new subscriber and return its dedicated queue.

(self)

Source from the content-addressed store, hash-verified

31 self._subscribers: list[queue.Queue] = []
32
33 def subscribe(self) -> queue.Queue:
34 """Register a new subscriber and return its dedicated queue."""
35 q: queue.Queue = queue.Queue(maxsize=_QUEUE_MAXSIZE)
36 with self._lock:
37 self._subscribers.append(q)
38 return q
39
40 def unsubscribe(self, q: queue.Queue) -> None:
41 """Remove a subscriber queue (called when the HTTP connection closes)."""

Callers 1

sse_streamFunction · 0.80

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected