Questions about @discordjs/proxy
hii, could someone tell me a bit about the
@discordjs/proxy
package? i have seen the motives but im not sure about it. mainly:
- why strip the ratelimit headers? i know it means REST
wont handle it but, whats the motive? in which case would you not want it to be handled for you?3 Replies
- 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!
- ✅
Marked as resolved by OPwell, let's get into what you said
we get that Response from proxy's
REST
instance (which DID read them and DID use them to account for the ratelimit)
if we didn't strip them, the REST client on the other end (either one in another language or ours if you're using discord.js anyway) would see them and also account for them
which would be pointless
you're doubling the handling of the ratelimit that way
we strip them to basically make the REST instance using the proxy think there's no ratelimits, which lets it take some faster codepaths by not calculating all those things
@discordjs/proxy
isn't all that useful unless you're doing something fancy, like a proxy that caches (something I've written before)
for general use we recommend just using our Docker containerah ok, i completely missed the part in the source where the proxy did use the
REST
instance to make the request, my bad
thanks for the clarification tho! that was my main issue, im good with the rest of the advantages of proxying