Resuming with cached data using @discordjs/ws

Could anyone guide me in the right direction for doing my own resumes with @discordjs/ws? I would like to get my shards in a state where the worker processes have been spawned, and the gateway connection are made, but without an identify being sent. I am attempting to cache my resume data so that with a restart of my ws process, I can resume. I tried using the following 2 lines of code:
await manager.updateShardCount(shardCount);
await strategy.spawn([...Array(shardCount).keys()]);
await manager.updateShardCount(shardCount);
await strategy.spawn([...Array(shardCount).keys()]);
to get my shards to be spawned, however doing a manager.send() after this, still results in the following error:
Error: WebSocketShard wasn't connected
at WebSocketShard.send (file:///prod/gateway/node_modules/.pnpm/@[email protected][email protected]/node_modules/@discordjs/ws/dist/index.mjs:745:13)
at MessagePort.<anonymous> (file:///prod/gateway/node_modules/.pnpm/@[email protected][email protected]/node_modules/@discordjs/ws/dist/index.mjs:1251:23)
Error: WebSocketShard wasn't connected
at WebSocketShard.send (file:///prod/gateway/node_modules/.pnpm/@[email protected][email protected]/node_modules/@discordjs/ws/dist/index.mjs:745:13)
at MessagePort.<anonymous> (file:///prod/gateway/node_modules/.pnpm/@[email protected][email protected]/node_modules/@discordjs/ws/dist/index.mjs:1251:23)
I'm not sure if maybe I also need some additional code on the worker/manager side to support resuming myself? I assumed not but any more info would be appreciated
2 Replies
d.js toolkit
d.js toolkit7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Sammy
SammyOP7mo ago
@discordjs/ws version 1.0.2, if it matters :) Also please do ping when responding here, probably wont see it quickly otherwise! Thank you very much :) not sure how i missed that, working perfectly now
Want results from more Discord servers?
Add your server