Roon API - get full queue contents?

Is transport.subscribe_queue(...) the only supported way to get queue contents?

Or is there any request-style API to get the current full queue on demand. Are extensions expected to build/maintain queue state only from the subscribe_queue callback’s items and changes?

If max_item_count is large enough, would the initial Subscribed callback contain the full queue, or is it just a window around the current track?

Thanks,
- Eric

Yes

No, however you can easily mimic an on-demand pull by exploiting the underlying subscription lifecycle.

The strategy is to execute subscribe_queue, extract the full array immediately during the initial event, and terminate the connection. This populates your data structure, and immediately fires the unsubscribe hook.

function getQueueOnDemand(transport, zone, maxItems, callback) {
    // 1. Initiate the subscription
    const subscription = transport.subscribe_queue(zone, maxItems, (cmd, data) => {
        if (cmd === "Subscribed") {
            // 2. Safely capture the current full queue contents
            const fullQueue = data.items || [];
            
            // 3. Immediately kill the subscription to avoid background overhead
            subscription.unsubscribe();
            
            // 4. Return the data to your application
            callback(null, fullQueue);
        }
    });
}

// Usage Example:
getQueueOnDemand(transport, myZone, 300, (err, queue) => {
    console.log("On-demand queue contents retrieved:", queue);
});

Can you expand on what you’re looking to do?

Unfortunately, transport.subscribe_queue() only returns queue items starting from the currently playing track to the end of the queue. It only contains the full queue if the first item happens to be playing.

I set maxItems in my tests large enough to capture thousands of items, which roon happily returns. But only from the currently playing track and onwards.

Thanks,

  • Eric