Skip to content
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

[Feature] Ability to set url before reconnecting #59

Open
hakimio opened this issue Feb 25, 2020 · 1 comment
Open

[Feature] Ability to set url before reconnecting #59

hakimio opened this issue Feb 25, 2020 · 1 comment

Comments

@hakimio
Copy link

hakimio commented Feb 25, 2020

Right now in order to change websocket url you have to create a new instance of Sockette. This an issue for us because our url includes authorization token which expires after some time and when Sockette tries to reconnect it tries to reconnect using an expired token.

Here are a couple of possible solutions to this issue:

  1. getUrl config which can be set to a function which either returns a string directly or a Promise<string>. Sockette would use this function every time it tries to automatically establish websocket connection.
  2. setUrl() method on the Sockette class and ability to set onreconnect config to a function which returns a Promise. Sockette would wait for onreconnect promise to finish before it would try to reestablish connection.

@lukeed what do you think about it? Do you have any better suggestions?

@Gabiras12
Copy link

Hi i've the same issue. I think the best approach it to update the url param to be a function or a promise or a string the resolves to the websocket URL. Check out #65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants