HeartBeatTolerance

data class HeartBeatTolerance(val outgoingMargin: Duration = Duration.ZERO, val incomingMargin: Duration = 500.milliseconds)(source)

Defines tolerance for heart beats.

If both the client and server really stick to the heart beats periods negotiated and given by the CONNECTED frame, network latencies will make them miss their marks. That's why we need some sort of tolerance.

In case the server is too strict about its expectations, we can send heart beats a little earlier than we're supposed to (see outgoingMargin).

In case the server really sticks to its own period without such margin, we need to allow a little delay to make up for network latencies before we fail and close the connection (see incomingMargin).

Constructors

Link copied to clipboard
constructor(outgoingMargin: Duration = Duration.ZERO, incomingMargin: Duration = 500.milliseconds)

Properties

Link copied to clipboard

How much more to wait before failing when we don't receive a heart beat from the server in the expected time.

Link copied to clipboard

How much time in advance heart beats should be sent. This is to avoid issues when servers are not very tolerant on heart beats reception.