def onOpen(self): # Make sending channel self.send_channel = Channel.new_name("django.websocket.send") self.factory.protocols[self.send_channel] = self # Send news that this channel is open Channel("django.websocket.connect").send( send_channel=self.send_channel, **self.request_info)
def get_response(self, request): request.reply_channel = Channel.new_name("http.response") Channel("http.request", channel_backend=self.channel_backend).send( request.channel_encode()) channel, message = self.channel_backend.receive_many_blocking( [request.reply_channel]) return HttpResponse.channel_decode(message)
def onOpen(self): # Make sending channel self.reply_channel = Channel.new_name("!websocket.send") self.request_info["reply_channel"] = self.reply_channel self.last_keepalive = time.time() self.factory.protocols[self.reply_channel] = self # Send news that this channel is open Channel("websocket.connect").send(self.request_info)
def onOpen(self): # Make sending channel self.reply_channel = Channel.new_name("!websocket.send") self.request_info["reply_channel"] = self.reply_channel self.last_keepalive = time.time() self.factory.reply_protocols[self.reply_channel] = self # Send news that this channel is open Channel("websocket.connect").send(self.request_info)
def onOpen(self): # Make sending channel self.send_channel = Channel.new_name("django.websocket.send") self.factory.protocols[self.send_channel] = self # Send news that this channel is open Channel("django.websocket.connect").send( send_channel = self.send_channel, **self.request_info )
def get_response(self, request): request.response_channel = Channel.new_name("django.wsgi.response") Channel("django.wsgi.request", channel_backend=self.channel_backend).send(**request.channel_encode()) channel, message = self.channel_backend.receive_many_blocking([request.response_channel]) return HttpResponse.channel_decode(message)
def __init__(self, *args, **kwargs): Request.__init__(self, *args, **kwargs) self.reply_channel = Channel.new_name("!http.response") self.channel.factory.reply_protocols[self.reply_channel] = self