(
request: request.Request[Any, Any],
socket: WebSocketConnection,
path: str = "",
)
| 161 | options: Options, |
| 162 | ) -> None: |
| 163 | async def model_stream( |
| 164 | request: request.Request[Any, Any], |
| 165 | socket: WebSocketConnection, |
| 166 | path: str = "", |
| 167 | ) -> None: |
| 168 | asgi_app = getattr(request.app, "_asgi_app", None) |
| 169 | scope = asgi_app.transport.scope if asgi_app else {} |
| 170 | if not scope: # nocov |
| 171 | logger.warning("No scope. Sanic may not be running with an ASGI server") |
| 172 | |
| 173 | send, recv = _make_send_recv_callbacks(socket) |
| 174 | await serve_layout( |
| 175 | Layout( |
| 176 | ConnectionContext( |
| 177 | constructor(), |
| 178 | value=Connection( |
| 179 | scope=scope, |
| 180 | location=Location( |
| 181 | pathname=f"/{path[len(options.url_prefix):]}", |
| 182 | search=( |
| 183 | f"?{request.query_string}" |
| 184 | if request.query_string |
| 185 | else "" |
| 186 | ), |
| 187 | ), |
| 188 | carrier=_SanicCarrier(request, socket), |
| 189 | ), |
| 190 | ) |
| 191 | ), |
| 192 | send, |
| 193 | recv, |
| 194 | ) |
| 195 | |
| 196 | api_blueprint.add_websocket_route( |
| 197 | model_stream, |
nothing calls this directly
no test coverage detected