Documentation Index
Fetch the complete documentation index at: https://docs.discovr.media/llms.txt
Use this file to discover all available pages before exploring further.
How sessions work
A session is a 30-minute browsing window. When you callselectProfile(), the SDK mints a session credential automatically. You never manage it directly — it’s included in every page and row request behind the scenes.
When a session expires, page fetches return SESSION_EXPIRED. Profile-scoped operations (lists, playback, scrobbling) still work — they use the long-lived identity credential, not the session.
Recommendation snapshots
Within a session, pages with the same filters always return the same page ID and results. This is intentional — it keeps your user’s experience consistent while they browse.| Scenario | Result |
|---|---|
| Same filters, same session | Same page ID, same rows |
| Same filters, new session | New page ID, fresh rows |
| Different filters, same session | Different page ID, different rows |
Keeping sessions alive
The SDK refreshes sessions in the background automatically — subscribe toonSessionRefreshed once after sign-in and your pages always use a fresh session:
expiresAt timestamp tells you exactly when the current session will auto-refresh — useful for pre-warming data before the snapshot turns over.
Handling SESSION_EXPIRED
Even with automatic refresh,SESSION_EXPIRED can reach your code — the user may browse without activity for over 30 minutes, or switch profiles just as a session lapses.
When it happens, the error echoes back the page’s original pageLevelFilters. Use them to recreate the page in the current session:
Paginating row items with
getRowItems() intentionally skips the freshness check — so users can keep scrolling a rail they’re already in without interruption.Recovery checklist
When you getSESSION_EXPIRED:
- Read
err.pageLevelFiltersfrom the error — this is the filter set for the stale page - Call
createPage()with those filters to create a fresh snapshot - Fetch the new page with
getPage() - Render fresh content — optionally show a brief “Updated” toast
Profile switching
Switching profiles creates a new session immediately. Page IDs from the previous profile’s session are stale:Related reading
- Sessions, Profiles & Sign Out — session lifecycle from the auth side
- Navigation flows — how to build navigation stacks that interact with sessions
- Lazy loading — avoid over-fetching pages that may expire
- Error handling — full error code reference
Next: Lazy Loading & Performance