/*********************************************************************************
* MQTT连接服务器返回2
* 说明:
* MQTT Client总是连接不上服务器,返回值是2。
*
* 2017-12-1 深圳 南山平山村 曾剑锋
********************************************************************************/
一、参考文档:
. Python Paho/MQTT : Detecting Connect error
https://*.com/questions/42451427/python-paho-mqtt-detecting-connect-error
. paho-mqtt 1.3.
https://pypi.python.org/pypi/paho-mqtt
二、connection result
The value of rc indicates success or not:
: Connection successful
: Connection refused - incorrect protocol version
: Connection refused - invalid client identifier
: Connection refused - server unavailable
: Connection refused - bad username or password
: Connection refused - not authorised
-: Currently unused.
三、解决方法:
设置一下Client Id就行了。