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

feat: a function to generate URI before every connecting #31

Open
1 task
laeo opened this issue Aug 26, 2023 · 2 comments
Open
1 task

feat: a function to generate URI before every connecting #31

laeo opened this issue Aug 26, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@laeo
Copy link

laeo commented Aug 26, 2023

Description

I want to add the user authentication token as query param to URI, but the token has short lifetime, while trying reconnect after token expires, there is no way to update the token, it will stuck looping.

WebSocket(
  uri: () => "wss://localhost/?_token=xxxxx", // we can use the callback to retrieve valid token before connects.
);

Requirements

  • A function to generate URI before every connect happens.

Additional Context

No.

@richiehowelll
Copy link

This would be helpful for me, are there any suggested alternatives to handle a situation like this?

@wkok
Copy link

wkok commented Aug 25, 2024

Plus one as I'm also in need of this.
In my case the jwt token is sent in the request headers, not the Uri, but the same principle applies - if we could have a way to update the request (Uri / headers etc.) before reconnecting, that would be really helpful.

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

No branches or pull requests

4 participants