Any way to reconnect when node restarts
I'm currently using the reconnect: { basic: whatever } property in my nodes. While this works whenever the node requests a websocket reconnect it doesn't attempt to reconnect whenever the node is restarting
20 Replies
lavalink doesn't request reconnects
could you elaborate?
I'll probably have to port over the nodejs reconnection logic anyways
Whenever the socket reconnects
Any updates regarding this? As it’s fairly inconvenient for me to restart the bot whenever lavalink gets restarted
yeah sorry, I'll look into it right now
It’s fine, it hasn’t gotten on my nerves to the point I wrote my own reconnect function like I’ve done before it other issues lol
looks to be an issue with the ws lib
doesn't catch closes
Love how Deno has completely removed websockets from their stdlib
iirc they replaced it with a upgradeWebsocket method on the Deno namespace where you provide a http request, it's a bit jank though
That would probably be better than me just writing my own ws lib
pretty sure that's for the server though
yeah incoming http request
the only client-side websocket class is through web apis
and that doesn't support headers
The Websocketstream api supports headers, although that's probably gonna take more work to implement than just writing a custom socket wrapper
hmm
it's also unstable
Sockets don't seem to be getting much attention in deno as a whole, pogsockets was the only working one I could find that actually somewhat worked
i copied it from the stdlib before they removed it
there's other solutions but they either don't work or have conflicting docs (references code that doesn't exist in the library)
it's been a mess, I may investigate websocketsteam one day as socketio is a library I used a ton and having an alt for deno would be nice
I'll probs write my own ws lib one day
rn im just gonna copy stuff over from the stdlib
apparently if all you're using headers for is auth then you can do
var ws = new WebSocket("ws://username:[email protected]/service");
or var ws = new WebSocket("ws://[email protected]/service");
seems kinda dumb though that even with the web standard there's no official way to add headersLavalink requires other headers
User-Id, Client-Name etc
So found the issue
When the server doesn't send a close frame the socket just dies
And I don't handle that
should just be able to publish this and fix your issue
there we go
ty