lavaclient / lavadeno

lavadeno is a simple, easy-to-use, and flexible lavalink client built on the Deno Runtime.
Apache License 2.0
12 stars 4 forks source link

Reconnect deno to lavalink #12

Open JasperVanEsveld opened 2 years ago

JasperVanEsveld commented 2 years ago

Was wondering how reconnecting was supposed to work It mentions that reconnecting needs to be done manually but there are reconnection settings. Not sure if it is meant to support that or that the lavalink server can reconnect to discord

If that is the case, is there some way to detect that lavalink has gone down, like an event to listen to? Currently it silently stops until I try to play a track

viztea commented 2 years ago

Where does it say reconnection needs to be done manually? I'm pretty sure it does it automatically

JasperVanEsveld commented 2 years ago

In the readme, wording seemed confusing to me though: ...along with manual reconnecting as reconnecting isn't automatic

But my guess is that that section references lavalink's connection to discord and not deno to lavalink, right?

JasperVanEsveld commented 2 years ago

Tried looking through the code myself, seems that what I am looking for is an event that fires when the websocket to lavalink gets disconnected.

Which requires sending ping messages to detect, I might just catch the error when trying to send anything and try a reconnect.

Edit: Looking into it further currently reconnecting is supposed to keep the connection with lavalink alive. However, this only works if onClose is triggered, but that does not happen on a force close or a crash on lavalink's side. Maybe pogsocket could support sending heartbeats/ping-pongs so that such a disconnect is detected?