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).