MCPcopy Create free account
hub / github.com/LangGraph-GUI/LangGraph-GUI-backend / stream_to_frontend

Method stream_to_frontend

src/ServerTee.py:86–102  ·  view source on GitHub ↗

Yields log lines to a frontend until stop_event is set (if provided). This can be used in a Flask or FastAPI streaming endpoint.

(self, stop_event=None)

Source from the content-addressed store, hash-verified

84 self.subscribers.remove(q)
85
86 def stream_to_frontend(self, stop_event=None):
87 """
88 Yields log lines to a frontend until stop_event is set (if provided).
89 This can be used in a Flask or FastAPI streaming endpoint.
90 """
91 q = self.subscribe()
92 try:
93 while True:
94 if stop_event and stop_event.is_set():
95 break
96 try:
97 message = q.get(timeout=1)
98 yield message
99 except Empty:
100 continue
101 finally:
102 self.unsubscribe(q)

Callers

nothing calls this directly

Calls 2

subscribeMethod · 0.95
unsubscribeMethod · 0.95

Tested by

no test coverage detected