MCPcopy Index your code
hub / github.com/reactive-python/reactpy / model_stream

Function model_stream

src/py/reactpy/reactpy/backend/flask.py:185–199  ·  view source on GitHub ↗
(ws: WebSocket, path: str = "")

Source from the content-addressed store, hash-verified

183 sock = Sock(api_blueprint)
184
185 def model_stream(ws: WebSocket, path: str = "") -> None:
186 def send(value: Any) -> None:
187 ws.send(json.dumps(value))
188
189 def recv() -> Any:
190 return json.loads(ws.receive())
191
192 _dispatch_in_thread(
193 ws,
194 # remove any url prefix from path
195 path[len(options.url_prefix) :],
196 constructor(),
197 send,
198 recv,
199 )
200
201 sock.route(STREAM_PATH.name, endpoint="without_path")(model_stream)
202 sock.route(f"{STREAM_PATH.name}/<path:path>", endpoint="with_path")(model_stream)

Callers

nothing calls this directly

Calls 2

_dispatch_in_threadFunction · 0.85
constructorFunction · 0.50

Tested by

no test coverage detected