nextcord icon indicating copy to clipboard operation
nextcord copied to clipboard

feat: support resume_gateway_url for resuming

Open GestaIt opened this issue 3 years ago • 4 comments

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 pyright and 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, ...)

GestaIt avatar Aug 14 '22 02:08 GestaIt

Did you make sure this complies with discord/discord-api-docs#5323

ooliver1 avatar Aug 15 '22 23:08 ooliver1

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!

GestaIt avatar Aug 15 '22 23:08 GestaIt

Awesome, thank you!

ooliver1 avatar Aug 15 '22 23:08 ooliver1

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.

ooliver1 avatar Aug 23 '22 09:08 ooliver1

Discord seem to have finalised, in a convoluted way, how invalid sessions are handled - the behaviour in discord/discord-api-docs#5282

ooliver1 avatar Sep 21 '22 23:09 ooliver1