def send(self, encodedMessage): message = ChannelDemuxer.decodeMessage(encodedMessage) client = self._clientForMessage(message) try: client.write(message.content) except UserWarning: self.onMessageReceived_("", message.channelId)
def onMessageReceived_(self, content, channelId): try: channel = self.clients[channelId] message = Message(channel.channelGroup, channelId, channel.hostId, channel.outgoingSequenceNumber, content) channel.outgoingSequenceNumber += 1 self.onMessageReceived(ChannelDemuxer.encodeMessage(message)) except Exception: import traceback logging.error('ERROR: failed to dispatch received message\n%s' % traceback.format_exc())
def onMessageReceived_(self, content, channelId): try: channel = self.clients[channelId] message = Message( channel.channelGroup, channelId, channel.hostId, channel.outgoingSequenceNumber, content ) channel.outgoingSequenceNumber += 1 self.onMessageReceived(ChannelDemuxer.encodeMessage(message)) except Exception: import traceback logging.error('ERROR: failed to dispatch received message\n%s' % traceback.format_exc())