Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How node player resume works #40

Closed
EvilG-MC opened this issue Jul 1, 2024 · 3 comments
Closed

[Question] How node player resume works #40

EvilG-MC opened this issue Jul 1, 2024 · 3 comments

Comments

@EvilG-MC
Copy link
Contributor

EvilG-MC commented Jul 1, 2024

What I mean is, when a node goes offline, all players go offline.

Then, the manager tries to reconnect to the node and the player plays again.

With shoukaku this is automatically, but in the case of lavalink-client, what would it be like? Because if you put the sessionId in the nodes array, in My case it didn't seem to work.

@Tomato6966
Copy link
Owner

you need to call node.updateSession(true) in order to activate resuming.
Then you can provide the sessionId in the node connect / create options, and it will resume, if connected during the duration.
However you have to manually re-create the players and the queue on the client yourself.
The queue can be stored externally and resynced via queue.utils.sync()
On a resumed session nodeManager emits a "resumed" event.

aka
See readme

@Tomato6966
Copy link
Owner

Tomato6966 commented Jul 1, 2024

https://github.com/Tomato6966/lavalink-client?tab=readme-ov-file#version-200

# Node Resuming got supported
# First enable it by doing: (It's now called updateSession)
+ await player.node.updateSession(true, 360_000);
# then when reconnecting to the node add to the node.createeOptions the sessionId: "" of the previous session
# and after  connecting the nodeManager.on("resumed", (node, payload, players) => {}) will be executed, where you can sync the players!

# Node Options got adjusted # It's a property not a method should be treated readonly
+ node.resuming: { enabled: boolean, timeout: number | null }; 

@EvilG-MC
Copy link
Contributor Author

EvilG-MC commented Jul 1, 2024

I see, thank you so much!

@Tomato6966 Tomato6966 pinned this issue Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants