NNG(Nano Message Next Generation) 会定期自动发送一些心跳吗?

Does NNG(Nano Message Next Generation) automatically transmit some heartbeat periodically?

我正在使用 NNG 作为我的服务器间消息队列。

背景:

  1. 我正在实施一对长期后台服务,它们正在与 NNG 通信;
  2. 协议:pair0@tcp;
  3. 有效载荷消息可能在一秒钟内出现,也可能在一天内出现;

我的问题: 如果在特定时间段内没有生成消息,NNG 是否会定期自动向每个对等方发送“心跳”消息以保持 TCP 连接处于活动状态?

如果不是,我应该自己做“心跳”吗?

顺便说一句,这是我第一次使用NNG。不知道有没有official/populated支持论坛,所以在这里问一下。如果存在这样的论坛,请。告诉我。 谢谢!

欢迎来到 NNG &

我们可以在任何情况下发送零大小的“应用程序级”心跳,如果我们希望我们的传输坚如磐石被证明是 RTO

然而,NNG 使用 nn_setsockopt()-配置器选项 { ... | NN_RECONNECT_IVL | NN_RECONNECT_IVL_MAX | ... } 来微调底层细节,包括失败/关闭的套接字的重新连接管理

完整的调用签名是:

int nn_setsockopt(        int  sock,
                          int  level,
                          int  option,
                   const void *val,
                       size_t  sz
                   );

和一些关于 NN_RECONNECT_*-s 的细节:

NN_RECONNECT_IVL
Reconnect interval in milliseconds. After an outgoing connection is closed or fails, the socket will automatically attempt to reconnect after this many milliseconds. This is the starting value for the time, and is used in the first reconnection attempt after a successful connection is made. The default is 100.

NN_RECONNECT_IVL_MAX
Maximum reconnect interval in milliseconds. Subsequent reconnection attempts after a failed attempt are made at exponentially increasing intervals (back-off), but the interval is capped by this value. If this value is smaller than NN_RECONNECT_IVL, then no exponential back-off is performed, and each reconnect interval will be determined solely by NN_RECONNECT_IVL. The default is zero.