Client stops sending heart beat outgoing packets
kris-g opened this issue · 6 comments
I have noticed that sometimes a heart beat interval is being missed.
The debug logs don't seem to indicate any problems, the PING messages simply stop. The heart beat interval is 20secs and so the TTL of 40secs on my broker is missed eventually and a disconnect message sent to the client and received. So it seems the web socket connection is still stable.
I have tried setting a log point on the client interval code which sends the heart beat and it seems it simply stop emitting for some reason.
It may be related but this is an Angular 11 app running embedded inside an iframe.
The problem has been observed using Chrome, Edge and Electron based browsers.
Debug log output attached showing connection established, pings sent and then eventually disconnect from broker due to heart beat not being sent for the TTL period...
ng2-stompjs-debug.log
My config class...
`
export const StwStompConfig: InjectableRxStompConfig = {
// Which server?
brokerURL: environment.apiWs,
// How often to heartbeat?
// Interval in milliseconds, set to 0 to disable
heartbeatIncoming: 0, // Typical value 0 - disabled
heartbeatOutgoing: 20000, // Typical value 20000 - every 20 seconds
// Wait in milliseconds before attempting auto reconnect
// Set to 0 to disable
// Typical value 500 (500 milli seconds)
reconnectDelay: 10000,
discardWebsocketOnCommFailure: true,
// Will log diagnostics on console
// It can be quite verbose, not recommended in production
// Skip this key to stop logging to console
debug: (msg: string): void => {
console.log(msg);
}
};
`
Please check if you are impacted by stomp-js/stompjs#335, if yes, it is worth following the advice towards the end of the thread.
Please check if you are impacted by stomp-js/stompjs#335, if yes, it is worth following the advice towards the end of the thread.
Spot on! I have changed heartbeat interval to 60s and the problem seems to be resolved now.
Should the default interval values be changed if Chrome is now enforcing this behaviour since Jan 2021?
I think it will be a good idea. Changing the defaults and also examples and samples.