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
V
viztea572d ago
lavalink doesn't request reconnects could you elaborate? I'll probably have to port over the nodejs reconnection logic anyways
B
Bloxs569d ago
Whenever the socket reconnects Any updates regarding this? As it’s fairly inconvenient for me to restart the bot whenever lavalink gets restarted
V
viztea569d ago
yeah sorry, I'll look into it right now
B
Bloxs569d ago
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
V
viztea569d ago
looks to be an issue with the ws lib doesn't catch closes Love how Deno has completely removed websockets from their stdlib
B
Bloxs569d ago
iirc they replaced it with a upgradeWebsocket method on the Deno namespace where you provide a http request, it's a bit jank though
V
viztea569d ago
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
B
Bloxs569d ago
The Websocketstream api supports headers, although that's probably gonna take more work to implement than just writing a custom socket wrapper
V
viztea569d ago
hmm it's also unstable
B
Bloxs569d ago
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
V
viztea569d ago
i copied it from the stdlib before they removed it
B
Bloxs569d ago
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
V
viztea569d ago
I'll probs write my own ws lib one day rn im just gonna copy stuff over from the stdlib
B
Bloxs569d ago
apparently if all you're using headers for is auth then you can do var ws = new WebSocket("ws://username:password@example.com/service"); or var ws = new WebSocket("ws://my_token@example.com/service"); seems kinda dumb though that even with the web standard there's no official way to add headers
V
viztea569d ago
Lavalink 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
V
viztea569d ago
No description
V
viztea569d ago
should just be able to publish this and fix your issue
V
viztea569d ago
there we go
No description
V
viztea569d ago
B
Bloxs569d ago
ty