[Feature] Ability to set url before reconnecting
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.5k
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
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:
getUrlconfig which can be set to a function which either returns astringdirectly or aPromise<string>. Sockette would use this function every time it tries to automatically establish websocket connection.setUrl()method on the Sockette class and ability to setonreconnectconfig to a function which returns aPromise. Sockette would wait foronreconnectpromise to finish before it would try to reestablish connection.
@lukeed what do you think about it? Do you have any better suggestions?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading Sockette's reconnect path and how it currently stores and uses the WebSocket URL. Compare the proposed getUrl and setUrl/onreconnect approaches, including asynchronous reconnect behavior, and confirm the intended API with the maintainer before changing anything. Done means reconnects can obtain a fresh authorization URL without creating a new Sockette instance, with coverage for the selected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100