How to know if client is connected?
See original GitHub issueI’m using hbmqtt v0.9.0. My program, as an MQTT client, sometimes gets “Disconnected from broker” log and no longer receive new data from Mosquitto broker. I’m using default config (with auto-reconnect).
I have questions:
- Does “auto-reconnect” work when connection is lost, while waiting for message in
deliver_message()
? - Any way to check if client is connected, so that I can call
reconnect()
and subscribe again?
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
How does a server know that a client is connected to it or not?
A server on its own may or may not have to.. An application (using the appropriate communication stack) may know if it is...
Read more >Check client connection and connection/session takeover - IBM
The check is performed by sending a Timemark to each existing connection. The new connection is delayed early in the connection negotiation until...
Read more >c - How to know if a new client is connecting to a socket with ...
Example : I have two clients set on fd user1 (fd = 4) and user2 (fd = 5). So, I use select to...
Read more >How to check if same client is reconnected in client socket
When the Socket connect to clients, it has two pasts information, IP and port. You compare IP first to make sure whether it...
Read more >Client API - Socket.IO
forceNew <boolean> whether to create a new connection ... To understand what happens under the hood, the following example:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Have done for myself in this dirty way.
If some kind of callback`s applicable for current project. I’m glad to prepare PR
Yeah, looks like the only way is to not use the broken reconnect functionality:
dirty but works