eclipse / paho.mqtt.m2mqtt

Eclipse Public License 1.0
512 stars 303 forks source link

How to identify Reason for connection Failure #63

Closed Salma175 closed 6 years ago

Salma175 commented 6 years ago

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;