Setup streaming on ASGI

This commit is contained in:
Adam Hopkins
2019-05-27 00:57:50 +03:00
parent 7b8e3624b8
commit 3ead529693
4 changed files with 56 additions and 19 deletions

View File

@@ -82,7 +82,7 @@ class Sanic:
Only supported when using the `app.run` method.
"""
if not self.is_running:
if not self.is_running and self.asgi is False:
raise SanicException(
"Loop can only be retrieved after the app has started "
"running. Not supported with `create_server` function"
@@ -997,7 +997,7 @@ class Sanic:
if stream_callback:
await stream_callback(response)
else:
# Should only end here IF it is an ASGI websocket.
# Should only end here IF it is an ASGI websocket.
# TODO:
# - Add exception handling
pass