myRxStompConfig.beforeConnect = () => {
currentTry++;
if(currentTry> 1)
{
console.log(`Connection Time: (${new Date().getMilliseconds().toString()})
ReconnectDelay: (${myRxStompConfig.reconnectDelay}) `)
rxStomp.configure({reconnectDelay: 500 * Math.pow(2, currentTry)});
}
if (currentTry > maxConnectionAttempts) {
console.log(`Exceeds max attempts (${maxConnectionAttempts}), will not try to connect now`);
// It is valid to call deactivate from beforeConnect
rxStomp.deactivate();
**Can i call API service to something?**
}
rxStomp.configure(myRxStompConfig);
if(currentTry !== maxConnectionAttempts)
rxStomp.activate();
return rxStomp;
}
In general, you can make external API calls from this callback. Depending on what you want to achieve, you may have to use async/await or Promise appropriately.
Hi,