I just try to connect to my Bluemix IOT Foundation instance with a mosquitto mqtt client. I configured everything as described in https://docs.internetofthings.ibmcloud.com/messaging/devices.html. My python client connects but disconnect after a second.
import paho.mqtt.client as mqtt
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
client.subscribe("$SYS/#")
def on_disconnect(client, userdata, rc):
print("Disconnect with result code "+str(rc))
def on_message(client, userdata, msg):
print(msg.topic+" "+str(msg.payload))
client = mqtt.Client(client_id="d:gixu3a:RaspberryPi:abcdefgh")
client.on_connect = on_connect
client.on_message = on_message
client.on_disconnect = on_disconnect
client.username_pw_set("use-token-auth", password="XXXXXXX")
client.connect("gixu3a.messaging.internetofthings.ibmcloud.com", 1883, 60)
client.loop_forever()
Return code when I get disconnected is 1 and I can also see the connection inside the IOT Foundation dashboard:
Connection State
Disconnected on Saturday, October 10, 2015 at 9:10:22 PM from 89.140.177.130
with an insecure connection Refresh
Can I get any logfile from the Bluemix side?