Open ryanm opened 1 year ago
The connection should be reestablished after it closed, and for that the "close" message should be handled from the websocket. For an example that keeps working endlessly checkout https://gitlab.com/MathijsBlok/discord-mirror
As others have said, gateways have a lifespan of (roughly) 3 hours. After that they stop working. The stream ends.
What causes the gateway connection to silently fail?
Hypothesis: The token has expired. (False.) If I restart my node app, the token works again.
How do I detect when a failure occurs?
Hypothesis: If I wrap
gateway.on('message', callback)
in a try-catch it might throw an error. I will try that.In any case, I see 3 options:
All I want: To fetch messages from a public discord channel that I do not admin. Selfcore provides the real-time stream, and I figured I would hunt for another library to do one-time downloads.
Any guidance would be greatly appreciated.