stomp-js / stompjs

Javascript and Typescript Stomp client for Web browsers and node.js apps
Apache License 2.0
742 stars 80 forks source link

Max reconnect attempts and exponential back-off #249

Open crohde7707 opened 4 years ago

crohde7707 commented 4 years ago

I was looking for an example where I could either set a max number of reconnect attempts, and couldn't find any. I saw an issue on the ng2-stompjs project, but is there one specific to this project?

kum-deepak commented 4 years ago

I will add a FAQ entry for this soon. Give me few days.

crohde7707 commented 4 years ago

Thanks, any update on this?

kum-deepak commented 4 years ago

I have created a branch of samples implementing this. It also implements exponential back-off, i.e., each subsequent connection attempt will after 200, 400, 800, 1600 ... ms.

See the diff at https://github.com/stomp-js/samples/pull/4/files and full source at https://github.com/stomp-js/samples/blob/max-reconnects/stompjs/chat/chat.html

crohde7707 commented 4 years ago

Awesome, thanks for the samples!

kum-deepak commented 4 years ago

Keeping it open for a while till I create a FAQ entry.

kyun commented 2 years ago

Is this still open? :( I need some option like maxAttempt: 10

Rupa2398 commented 1 year ago

Is there a solution or workaround for configuring max reconnect attempts?