Please describe the changes this PR makes and why it should be merged:
This PR introduces support for resuming when initially connecting to the websocket.
This can be really useful in case of a gateway process crash, it allows reducing packet loss significantly and is overall a faster recovery.
Example:
// get some data from something like Redis with up-to-date sequence and sessionId for each shard
// your data should be in the following format:
// [
// { sessionId: 'this_is_totally_valid', sequence: 129 },
// { sessionId: 'this_is_also_valid', sequence: 200 }
// ]
// Where the index of the object is the index of the shard *local* to this cluster.
// To clarify, if you have 2 clusters - each 3 shards and this code is running in your second cluster,
// your arrray indeces should be 0, 1, 2 - representing Discord shards 3, 4 and 5
const data = getData();
await clusterInstance.connect(data);
Status and versioning classification:
Code changes have been tested against the Discord API, or there are no code changes
This PR changes the library's interface (methods or parameters added)
Please describe the changes this PR makes and why it should be merged: This PR introduces support for resuming when initially connecting to the websocket.
This can be really useful in case of a gateway process crash, it allows reducing packet loss significantly and is overall a faster recovery.
Example:
Status and versioning classification: