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(gateway,model): Add handling for gateway resume url #1894

Merged
merged 4 commits into from
Sep 8, 2022

Conversation

MinnDevelopment
Copy link
Contributor

This adds handling for the new gateway_resume_url, which is provided in the READY dispatch. Resuming should happen on that URL instead of the normal wss://gateway.discord.gg.

I tested this using ClusterBuilder:

let shards = ShardScheme::try_from((0..1, 1))?;
let (cluster, _) = ClusterBuilder::new(token.clone(), Intents::None)
    .shard_scheme(shards)
    .build()
    .await?;

cluster.up().await;

tokio::time::sleep(Duration::from_secs(1)).await;

let hashmap = cluster.down_resumable();

let (cluster, _) = ClusterBuilder::new(token, Intents::None)
    .shard_scheme(shards)
    .resume_sessions(hashmap)
    .build()
    .await?;

cluster.up().await;

Reference: discord/discord-api-docs#5282

@github-actions github-actions bot added c-gateway Affects the gateway crate c-model Affects the model crate c-standby Affects the standby crate t-feature Addition of a new feature labels Sep 7, 2022
@7596ff
Copy link
Contributor

7596ff commented Sep 8, 2022

We've added support for this on the next branch, via #1809. However, I think adding this to main is still worth it.

@Erk- Erk- self-requested a review September 8, 2022 18:23
Copy link
Member

@Erk- Erk- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a miniscule nit, otherwise look good to merge

twilight-gateway/src/shard/processor/impl.rs Outdated Show resolved Hide resolved
Co-authored-by: Erk <Erk-@users.noreply.github.com>
@7596ff 7596ff merged commit e825f25 into twilight-rs:main Sep 8, 2022
@MinnDevelopment MinnDevelopment deleted the feat/resume-url branch September 8, 2022 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-gateway Affects the gateway crate c-model Affects the model crate c-standby Affects the standby crate t-feature Addition of a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants