eclipse/paho.mqtt.m2mqtt

How to identify Reason for connection Failure

Salma175 opened this issue · 0 comments

Hi I am using M2mqtt with unity . every thing works fine but when my connection fails i need the reason to be displayed on screen so that user can identify . As mqtt python client has a callback which gives return codes
0: Connection successful
1: Connection refused – incorrect protocol version
2: Connection refused – invalid client identifier
3: Connection refused – server unavailable
4: Connection refused – bad username or password
5: Connection refused – not authorised
6-255: Currently unused.
Is there any method in this m2mqtt through which we can identify the connect failure reason .

I have found that i can receive an byte code but even before that Exception is being thrown and i am unable to receive the connack code . How to solve this .

Here is the code
byte connack=client.Connect (client_id, userName, password,false,3);
Debug.Log ("Client Connection status..."+connack.ToString());

//Log is not getting printed;