Session Resuming
Ryanlink supports Lavalink session resuming — when the WebSocket reconnects with the same session ID, Lavalink restores all player states server-side so audio continues without interruption.
Enable Session Resuming
Section titled “Enable Session Resuming”const manager = new RyanlinkManager({ resuming: { enabled: true, timeout: 60000, // Lavalink holds the session for 60 seconds after disconnect },});When the node reconnects, Ryanlink automatically calls node.updateSession() to register the session. On the nodeReady event, payload.resumed will be true if the session was successfully resumed.
manager.nodeManager.on('nodeReady', (node, payload) => { if (payload.resumed) { console.log(`Node ${node.id} resumed — session: ${payload.sessionId}`); } else { console.log(`Node ${node.id} connected fresh — session: ${payload.sessionId}`); }});Manual Session ID
Section titled “Manual Session ID”To resume a specific session after a bot restart, pass sessionId in the node config:
nodes: [{ id: 'main', host: 'localhost', port: 2333, authorization: 'youshallnotpass', sessionId: 'your-previous-session-id',}]Ryanlink will include this session ID in the WebSocket handshake headers, allowing Lavalink to resume the session.
Previous Tracks Buffer
Section titled “Previous Tracks Buffer”Ryanlink keeps a circular buffer of previously played tracks per player:
queueOptions: { maxPreviousTracks: 25, // default}
// Access in your commandsconst prev = player.queue.previous; // Track[]Track Resolve Retries
Section titled “Track Resolve Retries”For unresolved tracks (e.g. Spotify metadata resolved to YouTube), configure retry behavior:
const manager = new RyanlinkManager({ trackResolveRetryLimit: 3, // global default autoSkipOnResolveError: true, // skip to next track on failure});
// Or per-playermanager.createPlayer({ guildId: '...', voiceChannelId: '...', trackResolveRetryLimit: 5,});When all retries are exhausted, trackError is emitted and the track is skipped if autoSkipOnResolveError is true.
Auto-Reconnect on Voice Disconnect
Section titled “Auto-Reconnect on Voice Disconnect”Configure what happens when the bot is disconnected from voice:
playerOptions: { onDisconnect: { destroyPlayer: false, // don't destroy the player autoReconnect: true, // reconnect automatically autoReconnectOnlyWithTracks: true, // only reconnect if queue has tracks },}When autoReconnect: true:
player.connect()is called to rejoin the voice channel- If
player.queue.currentexists,player.play({ position, paused })resumes from the last position - If only
player.queue.trackshas items,player.play()starts the next track - If the reconnect fails,
player.destroy(DestroyReasons.PlayerReconnectFail)is called