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

fix(WebsocketShard): pass ignoreACK into sendHeartbeat when Discord asks for one #3993

Merged
merged 1 commit into from
Mar 25, 2020

Conversation

didinele
Copy link
Member

@didinele didinele commented Mar 25, 2020

Please describe the changes this PR makes and why it should be merged:
Currently when Discord sends a "HEARTBEAT" payload (opcode 1) discord.js simply calls sendHeartbeat with the appropriate label, without actually telling it to not check if the last heartbeat ever got the ACK.

What can end up happening in its current state is:

  1. d.js sends a regular beat, on the interval
  2. Discord asks for another beat using OP 1
  3. d.js calls sendHeartbeat yet again which will check if the beat sent on step 1 recieved the ACK; if it has, nothing horrible happens, otherwise d.js will respawn the shard under the impression that we're dealing with a zombie connection.

Status

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

Semantic versioning classification:

  • This PR changes the library's interface (methods or parameters added)
    • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)
  • This PR only includes non-code changes, like changes to documentation, README, etc.

Copy link
Member

@vladfrangu vladfrangu left a comment

Choose a reason for hiding this comment

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

This is a minor thing, and it shouldn't really matter, but it makes sense to skip the checks considering Discord asked us for one, LGTM

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

Successfully merging this pull request may close these issues.

3 participants