Closed asjadsaboor-10p closed 3 years ago
This pr does not cover the case that presenceTimeout
is not set. Based on the v4.27.1 implementation, the value of the heartbeatInterval should be (PRESENCE_TIMEOUT_MINIMUM / 2 - 1 ) when presenceTimeout is 0
setPresenceTimeout(val: number): this {
if (val >= PRESENCE_TIMEOUT_MINIMUM) {
this._presenceTimeout = val;
} else {
this._presenceTimeout = PRESENCE_TIMEOUT_MINIMUM;
// eslint-disable-next-line no-console
console.log(
'WARNING: Presence timeout is less than the minimum. Using minimum value: ',
this._presenceTimeout
);
}
this.setHeartbeatInterval(this._presenceTimeout / 2 - 1);
return this;
}
The root cause of this is the change in config.js that does not give a default value to the heartbeatInterval.
if (setup.presenceTimeout) {
this.setPresenceTimeout(setup.presenceTimeout);
} else {
this._presenceTimeout = PRESENCE_TIMEOUT_DEFAULT;
}
if (setup.heartbeatInterval != null) {
this.setHeartbeatInterval(setup.heartbeatInterval);
}
This should be resolved due to the minimum value check which is currently set to 20
Question: What should be the value of HeartbeatInterval when presenceTimeout is 0 ?