def sendData(self, msg, sock=None): try: super(ChatClientBase, self).sendData(msg, sock) except socket.error as err: self.log( 'Fail to send data "{}" to server / client, error = {}'.format( utils.lengthLimit(msg), err.args)) if self.isOnline(): self.stop(False)
def sendCommand(self, commandData): if self.isOnline(): self.log('Sending command "{}" to the client'.format( utils.lengthLimit(utils.commandData_to_string(commandData)))) self.sendData(json.dumps(commandData))
def sendMessage(self, messageData): if self.isOnline(): self.log('Sending message "{}" to the client'.format( utils.lengthLimit(utils.messageData_to_string(messageData)))) self.sendData(json.dumps(messageData))