-
Notifications
You must be signed in to change notification settings - Fork 726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On_disconnect Callback Returns ReasonCode=7 with EMQX over WebSockets in Paho MQTT" #803
Comments
reason code 7 = "MQTT_ERR_CONN_LOST"; this is returned when the network connection drops. As you have not provided any sample code, logs or much detail over when this happens ("when the client disconnects" - do you mean that you are calling |
I authenticate using JWT, and I'm experiencing reconnections approximately every minute. Regards |
I can't see anything much of interest in the broker logs (the lack of timestamps makes it hard to get a feel for the time-frames involved). I would suggest checking the client logs as well (just in case the paho client is dropping the connection). From the look of the log you are not receiving any messages? If both ends are just detecting loss of connection then it's a network issue (keep-alives should default to 60 seconds, so it's interesting there are none in the log). It would also be worth seeing if the connection remains up when testing with MQTTX (currently it's not clear where the problem lies). |
@MattBrittan logs (debug) python client paho-mqtt: logs broker: from the websocket client in the emqx dashboard, it also disconnects, that would be a way to rule out that it is not a paho-mqtt thing I can't connect from MQTTX regards |
sorry, I accidentally pressed close issue |
Nothing of real interest in these logs; it looks like the network connection is dropping (with neither the client or server initiating the disconnection).
Are you are saying that you have tested this using the websocket client in the emqx dashboard, and that fails in the same way? If so that indicates that it's not a fault with this library (given the lack of content in the EMQX log I'd guess at a network issue; perhaps try a 30s keep-alive in case something is dropping the connection after a minutes inactivity). |
I'm going to close this due to inactivity (and it looks like it may be a network issue as per the above comment). Please feel free to reopen with more info if applicable. |
Environment
Python version: 3.10.13
Library version: 1.6.1
Operating system (including version): Alpine Linux 3.18.5
MQTT server (name, version, configuration, hosting details): EMQX 5.4.1 hosted on an AWS EC2 instance. The server is set up with app Dokku configured with ports:add https:8443:8083. It also has SSL with the Dokku LetsEncrypt plugin. The domain is broker.mydomain.com and it's on Cloudflare with the proxy activated. MQTT protocol version 5, transport=websockets, client.tls_set(tls_version=ssl.PROTOCOL_TLSv1_2).
Question
I am encountering an issue where I receive a reasonCode=7 in the on_disconnect callback when using the Paho MQTT Python client. This happens under the following conditions:
Using MQTT protocol version 5
The connection is over WebSockets (transport=websockets)
TLS is configured with client.tls_set(tls_version=ssl.PROTOCOL_TLSv1_2)
The issue arises when the client disconnects from the EMQX broker. I would like to understand the possible causes of this reasonCode=7 and any solutions or workarounds that might be available. This reasonCode is not clearly defined in the MQTT 5.0 specification or in the Paho MQTT documentation, so any insights into its meaning and how to address the underlying issue would be greatly appreciated.
Regards
Matias
The text was updated successfully, but these errors were encountered: