should be `def on_connect(self, mosq, obj, rc)`
should be
def on_connect(self, mosq, obj, rc)