FAQs
Which commands work offline, and how are errors handled?
Which commands work offline, and how are errors handled?
To effectively manage offline scenarios, you must understand which commands require an active network connection and which function locally.Commands That Require a NetworkThe following commands always require an active internet connection. If you call them while offline, the SDK throws a
PlatformError (or a wrapped network error).-
Authentication:
login,registerUser,updatePartnerToken. -
Session Creation:
session.create(from the useAmbient hook). -
Initial Start: The
startmethod (fromuseAmbientSession) needs a connection once to establish the backend session stream.
- Capture: If the network drops after the session starts, the SDK continues to capture and buffer microphone audio locally in IndexedDB.
-
Pause and Resume: You can use
pauseandresumewhile offline. The SDK updates the local state immediately and reconciles it eventually when the connection returns. -
Submit:
- Online: The session finalize immediately.
- Offline: The SDK marks the session as “finalize-pending.” It automatically starts the upload process once the network is restored.
-
Cancel:
- Online: The session cancels immediately.
- Offline: The cancellation is queued. If the session is still valid when you reconnect, the SDK applies the cancellation.
-
Errors: Connectivity issues during online-only commands surface as
PlatformError. You should catch these and notify the user to check their connection. -
Status Updates: The outcome of offline actions (like
submitorcancel) is reflected in the session status. You can track this using theuseOfflineSessionshook in React.
The initial
create and start commands are the only critical points that require a network. After that, the SDK safely stores encrypted audio locally and syncs your submit or cancel actions eventually.How long does the Suki remain in offline mode?
How long does the Suki remain in offline mode?
There is no fixed timeout for offline mode. As long as the browser’s IndexedDB remains intact, the SDK preserves the buffered sessions.If you close the browser tab or window, the SDK scans the database when you re-initialize the
PlatformClient on the next load. It then automatically starts
uploading any offline sessions that you previously submitted. The browser’s storage settings determine the effective lifetime of this offline data.Effective lifetime of offline data is governed by browser storage and not by an internal SDK timer.
What happens if I refresh the page while a session is recording?
What happens if I refresh the page while a session is recording?
The SDK manages session persistence internally. If an ongoing session is interrupted by a refresh or relaunch, you can resume it by passing the same
ambientSessionId.The session continues from where it left off, and you can track updates via the useOfflineSessions hook.