-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
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
Events of attempts to reconnect #101
Comments
Hey Dmitriy! Thanks for the feedback. That isn't currently possible, but it wouldn't be a large code change. I can try to do that soon, or I would accept a PR for that functionality. |
retry.timeouts(opts) can be used to get the list of timeout values to be able to report how long until the next retry. In ReconnectingWebsocket.js we can alter both handleError and handleClose to set a private member variable to indicate we are reconnecting. Then in the connect method, check for that and emit an event on each connection attempt, along with some metadata about what attempt number it is, how many total attempts there will be, and the time until the next attempt. Lastly, we'd need to reset the reconnecting instance var once we exhaust our attempts or are successful. And of course write tests 😊 (the hard part) |
Hi Chad! I'm not a good programmer yet, so I can't do PR. However, I got your idea. I reasoned about the same. |
And a few more points. If you start to connect to a remote server in the absence of a network, errors can also not be caught without debug. They simply have nowhere to catch as there is no websocket object. This object appears only when there is a connection, if I understand correctly. |
Thanks for the additional feedback Dmitriy 😊 I created #102 and #103 to track those and allow us to continue that discussion in a dedicated place. Don't worry about the PR if you feel uncomfortable doing that. I think this feedback is great and would like to investigate these things and see if we can address them. My time is limited though so it may take a while 😅 I'm sure you understand. |
Is it possible to somehow get the events of attempts to reconnect to the asterisk websocket? Now it can be seen only through debug, but I want to process them on the client in production
The text was updated successfully, but these errors were encountered: