Closed Edvinas01 closed 5 years ago
I do understand the issue. However the way current code is structured the solution is not going to be straightforward.
Currently I am working at rewriting this library - see: https://github.com/stomp-js/stompjs/issues/1. This will be taken as a feature request there. I will not be able to work on this as of now.
If you need a solution now, I suggest one of the following:
client.reconnect_delay
to 0
to switch off auto reconnect. Handle reconnect outside by watching errorCallback
.Fixed in v5.0.0. Please upgrade https://stomp-js.github.io/stompjs/additional-documentation/upgrading.html
Context Before creating stomp
client
, my users fetchjwt
from the back-end. Then using thatjwt
aurl
is formed which is later used in stompclient
:Issue If
client
loses connection to the back-end, it tries to reconnect. However thejwt
which was used to initialize it can be expired. Which means theclient
will not be able to reconnect and will start looping in such case.Proposed solution Add a reconnect hook which would allow to alter
url
before reconnecting.