예제 #1
0
    def send(self, encodedMessage):
        message = ChannelDemuxer.decodeMessage(encodedMessage)

        client = self._clientForMessage(message)

        try:
            client.write(message.content)
        except UserWarning:
            self.onMessageReceived_("", message.channelId)
예제 #2
0
    def send(self, encodedMessage):
        message = ChannelDemuxer.decodeMessage(encodedMessage)

        client = self._clientForMessage(message)

        try:
            client.write(message.content)
        except UserWarning:
            self.onMessageReceived_("", message.channelId)
예제 #3
0
 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())
예제 #4
0
 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())