nextcord
nextcord copied to clipboard
feat: support resume_gateway_url for resuming
Summary
Resolves #762
Implements new gateway resume flow by using the resume_gateway_url from the READY event
Checklist
- [x] If code changes were made then they have been tested.
- [ ] I have updated the documentation to reflect the changes.
- [x] I have run
task pyrightand fixed the relevant issues.
- [x] This PR fixes an issue.
- [ ] This PR adds something new (e.g. new method or parameters).
- [x] This PR is a breaking change (e.g. methods or parameters removed/renamed)
- [ ] This PR is not a code change (e.g. documentation, README, ...)
Did you make sure this complies with discord/discord-api-docs#5323
Did you make sure this complies with discord/discord-api-docs#5323
Yeah so raise ReconnectWebSocket(self.shard_id, resume=False) will mean that the resume url isn't used (line 534 of the revised gateway in this PR). However, it looks like there's an example where it resumed even after receiving op code 9 (line 528)? In that case, since resume is not specified to be false, it will attempt to use the resume url
In any event, the comment I left on line 703 of the revised client.py shows that when the resume keyword argument is false, we do not use the given resume url
I hope this clarified things!
Awesome, thank you!
Unfortunately this is stalled due to this disappointing comment https://github.com/discord/discord-api-docs/pull/5282#issuecomment-1217108399.
Will wait for a few days before assuming this is a Discord "soomtm" that won't happen.
Discord seem to have finalised, in a convoluted way, how invalid sessions are handled - the behaviour in discord/discord-api-docs#5282