def METHOD_NAME(self, message):
    """
    Send TCP message as JSON string if the socket is connected.
    """
    if self.isConnected():
        message_str = message.toJSON() + "\n"
        self.socket.write(message_str.encode(self.encoding))
        self.socket.flush()
        if self.verbose:
            print("Sent: \n" + str(message))
    else:
        print(self.server_name + " socket not connected. \nDid not send:" )
        message.setError(True, "Communication Error: " + self.server_name + " socket not connected")
        print(message)
        self.messageReceived.emit(message) # Return message with error