We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I wanted to get your opinion on this. It seems there is no official approach to have dynamic reconnectPeriod.
reconnectPeriod
But it is possible to reuse the same concept as laid out in https://github.com/mqttjs/MQTT.js#refresh-authentication-options--signed-urls-with-transformwsurl-websocket-only via transformWsUrl
transformWsUrl
const transformWsUrl = (url, options, client) => { // dynamic reconnectPeriod example client.options.reconnectPeriod = this.backoff.current().delay; client.options.username = `token=${this.get_current_auth_token()}`; client.options.clientId = `${this.get_updated_clientId()}`; return `${this.get_signed_cloud_url(url)}`; } const connection = await mqtt.connectAsync(<wss url>, { ..., transformWsUrl: transformUrl, }); // somewhere in code on events `connect|reconnect|close|disconnect|offline|error|end` this.backoff.increase(); this.backoff.decrease();
On which of these lifecycle events should/would you increase+decrease reconnectPeriod?
When I've tried playing with events, it seems sometimes I'm getting multiple events firings of same type.
This makes it difficult to distinguish which event is actionable for increase/decrease.
The text was updated successfully, but these errors were encountered:
I like the idea, anyway I think this should be fixed before: #419
Sorry, something went wrong.
No branches or pull requests
Hi,
I wanted to get your opinion on this. It seems there is no official approach to have dynamic
reconnectPeriod
.But it is possible to reuse the same concept as laid out in https://github.com/mqttjs/MQTT.js#refresh-authentication-options--signed-urls-with-transformwsurl-websocket-only via
transformWsUrl
On which of these lifecycle events should/would you increase+decrease
reconnectPeriod
?When I've tried playing with events, it seems sometimes I'm getting multiple events firings of same type.
This makes it difficult to distinguish which event is actionable for increase/decrease.
The text was updated successfully, but these errors were encountered: