persist-web-session
persist-web-session
What this skill is
On a traditional multi-page website, every navigation is a full page load — and a full page load tears down the WebRTC session mid-sentence. Persistence keeps one conversation alive across those navigations: the SDK wraps the site in a same-origin iframe while the avatar stays in the top-level document, which never reloads. Navigation happens inside the frame; the session never notices.
NapsterCompanionApiSdk.init(getToken, {
persistence: { enabled: true },
});
getToken is the same token function the rest of the embed uses (Web SDK 2 — see [[deploy-webrtc]]). With persistence on, the avatar is always the floating widget: the SDK ignores layout.type: "inline" and layout.mountContainer, because the avatar has to live in the top-level document.
Ground the details in the live docs: https://developers.napster.com/docs/sdks/web-sdk/persistence
1. Decide whether it's needed at all
Ask one question: does navigating reload the page?