We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import asyncio from quart import Quart, Response app = Quart(__name__) @app.route('/') async def sub(): response = Response( data_stream(), mimetype="text/event-stream", ) response.timeout = None return response async def data_stream(): try: while True: print("Sending Data") if False: yield "data: {ok: true}\n\n" await asyncio.sleep(1) finally: print("Exited Gen") app.run()
The text was updated successfully, but these errors were encountered:
ha, please follow me :
import asyncio from quart import Quart, make_response, stream_with_context from datetime import datetime app = Quart(__name__) @app.route('/') async def sub(): @stream_with_context async def data_stream(): try: while True: print("Sending Data") yield "data: {ok: true}\n\n".encode() await asyncio.sleep(1) finally: print("Exited Gen") response = await make_response(data_stream()) response.timeout = None response.headers['Content-Type'] = 'text/event-stream' return response if __name__ == "__main__": app.run()
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: