def wrapped(req, *args, **kwargs): r = view(req, *args, **kwargs) if (isinstance(r, HttpResponse)): return r reply = { 'status': 200, 'headers': [ ('Content-Type', 'text/event-stream'), ], # we shall probably setup cache headers right as well 'more_content': True } if (r): group_name = r else: group_name = self.group_name req.message.reply_channel.send(reply) Group(group_name).add(req.message.reply_channel) # pop ! raise AsgiRequest.ResponseLater()
def subscribe(request): raise AsgiRequest.ResponseLater()