Tutorial by Examples

@route("/stream") def stream(): def event_stream(): while True: if message_to_send: yield "data: {}\n\n".format(message_to_send)" return Response(event_stream(), mimetype="text/event-stream&qu...
This example uses the asyncio SSE library: https://github.com/brutasse/asyncio-sse import asyncio import sse class Handler(sse.Handler): @asyncio.coroutine def handle_request(self): yield from asyncio.sleep(2) self.send('foo') yield from asyncio.sleep(2) ...

Page 1 of 1