Android Question MQTT and PINGREQ

quique

Member
Licensed User
Longtime User
Hi! I am just getting my feet wet into MQTT under B4A... and I cannot seem to find a way to issue a PINGREQ.

I've seen that Erel and other's code just go publishing into a topic as a way of "pinging" the Broker, but I would very much like to use the real PING functionality that MQTT protocol specifies, which is only 2 bytes long.

I just need to send 192,0 (2 bytes) and wait for 208,0 as a PONG ...

Did anyone got this working or can give me a hint ?

Also: My app seems to "freeze" for several seconds when starting up. Is this the mqtt library "starting up" ?

Regards,

Enrique
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Also: My app seems to "freeze" for several seconds when starting up. Is this the mqtt library "starting up" ?
Unlikely. You should start a new thread for this.

Ping requests are sent automatically based on the keep alive interval. Default value is 60 seconds.
You shouldn't try to use it in the application level.
 
Upvote 0

quique

Member
Licensed User
Longtime User
Thanks Erel. I did not find a "keep alive" setting, so I was having doubts about the whole thing, but now it is ok and I can work with 60 seconds PINGS.
 
Upvote 0
Top