Hi, I able to connect to the broker using different clients with the same username/password combination (mqttjs with node.js and mosquito_pub/sub), but not using mosquitto Python library. I use mosquitto 1.1.3 on Python 2.7 on Ubuntu 10.04.
I get rc=4 (CONNACK_REFUSED_BAD_USERNAME_PASSWORD) in on_connect method: The code looks like this: ... def __init__(self): client_id = "%s_%s" % (__file__, os.urandom(4).encode("hex")) log("client_id = %s" % client_id) self.shutdown = False self.client = mosquitto.Mosquitto(client_id=client_id, clean_session=True) self.client.username_pw_set('uername', 'password') self.client.on_connect = self.on_connect self.client.connect('localhost', 1883, keepalive=25) log("connect done") try: while True: self.client.loop(1000) except: self.client.disconnect() self.shutdown = True; def on_connect(self, client, obj, rc): log("on_connect rc=%d" % rc) # TODO - handle cases rc!=0 - i.e. connect errors if rc == 0: self.publish_thread = threading.Thread(target=self.do_publish_thread) self.publish_thread.start() ... Any ideas? Thanks in advance, Zvi
-- Mailing list: https://launchpad.net/~mosquitto-users Post to : mosquitto-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~mosquitto-users More help : https://help.launchpad.net/ListHelp