(ws: WebSocket, path: str = "")
| 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) |
nothing calls this directly
no test coverage detected