Bom dias Colegas

25 views
Skip to first unread message

Marcio Luis de Paula

unread,
Nov 11, 2022, 8:55:41 AM11/11/22
to MQTT
Estou fazendo um codigo e o link do MQTT Paho cai.

como manter a conexao mandando pum ping para manter viva a conexao?


tem algum exemplo python?

Andy Stanford-Clark

unread,
Nov 11, 2022, 9:27:30 AM11/11/22
to mq...@googlegroups.com
Sorry for my very poor Portugese… (thank you google translate!)

O cliente python Paho tem um exemplo que permanece ativo.
Às vezes, um firewall pode atingir o tempo limite de uma conexão - qual é o Keepalive definido? Tente 45 seg…


The Paho python client has an example which stays alive.
Sometimes a firewall can time out a connection - what is the keepalive set to? Try 45 sec…

Andy

Marcio Luis de Paula

unread,
Nov 11, 2022, 1:46:01 PM11/11/22
to mq...@googlegroups.com
Hi Andy!
thanks for this.

sorry my English language is not very good.

in my script code python is a problem:

if the keepallive time expires, the link is lost.
My commands are by buttons on and off.
if the keepallive time passes, the connection is lost.
Do you know any flag mode to watch the connection?

thanks



--
To learn more about MQTT see https://mqtt.org
---
You received this message because you are subscribed to a topic in the Google Groups "MQTT" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mqtt/Diqz11l_ikA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mqtt+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mqtt/4A6A9B21-35E1-4F9E-AF82-DAB7E6F98F40%40stanford-Clark.com.

Andy Stanford-Clark

unread,
Nov 11, 2022, 2:50:53 PM11/11/22
to 'Simon Walters' via MQTT
Does your program use 
loop()
Or 
loop_start()
?
This will keep an eye on the time and send a “ping” within the keep alive time to avoid the broker dropping the connection.

See Network loop section of the documentation: 

Andy

You received this message because you are subscribed to the Google Groups "MQTT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mqtt/CALNwGcVv5zjz24_wBkL%2BKrDAsrUZza-O8T2gtT0VNv_cLRHbfA%40mail.gmail.com.

Marcio Luis de Paula

unread,
Nov 13, 2022, 7:35:40 AM11/13/22
to mq...@googlegroups.com
Nice ! Thanks for this.
I'll try to solve it Tuesday.my application uses fair GUI in QT5. hence there are 6 command buttons. I'll have to call a routine and get out of it. cannot get stuck in the loop. I'm going to ride a motorcycle and refresh my mind.thanks for the help I will read about network loop, that solves it.

Reply all
Reply to author
Forward
0 new messages