Heartbeat detection mechanism

1. Concept

  • The sender sends a fixed format message to the receiver according to certain rules (periodic sending, idle sending, etc.), and the receiver replies with a fixed format message after receiving the message. , The current connection is considered invalid, and it is disconnected.
    Note: The sender can be the client or the server. Depending on the actual situation, the client is usually the sender.

2. Application scenarios

  • Determine whether the long connection is alive: When there is no traffic on the long connection, it is impossible to determine whether the communication is abnormal or the normal communication is not caused by business traffic. You can judge by sending heartbeat packets.
Published 25 original articles · praised 4 · visits 1516

Guess you like

Origin blog.csdn.net/weixin_39025362/article/details/105487963