netmq icon indicating copy to clipboard operation
netmq copied to clipboard

Do we need a manual heartbeat and keep-alive?

Open BondByteBlaster opened this issue 9 months ago • 1 comments

Hi,

I’ve implemented a manual heartbeat (PublisherSocket to SubscriberSocket) set to every 10 seconds, and a keep-alive (RequestSocket to ResponseSocket) every 30 seconds(2 retries). The purpose is to detect connection loss (so we can reconnect) and to prevent the connection from being dropped due to inactivity.

I’m aware that NetMQ has built-in support for both heartbeat and keep-alive, but they are disabled by default, and it seems many developers tend to avoid using them.

So, is there actually a need for implementing manual heartbeat and keep-alive like I’ve done?

Regards

BondByteBlaster avatar Mar 10 '25 22:03 BondByteBlaster

From experience, you would always want to create one because NetMQ doesn't seem to tell you if a connection is connected. It will usually just block a send request if connection to server is disconnected unless you specify a timeout.

ertaboy356b avatar May 16 '25 11:05 ertaboy356b