Skip to main content
Offline support is off by default. You turn it on once, at initialization, by passing an offline config to the AppSettingsBuilder. Until you do, the SDK behaves exactly as before. This page covers the minimal setup; for every tunable option see the Configuration & API Reference.
1

Requirements

Offline support requires CometChat JavaScript SDK 4.3.0 or later.
If you are new to the SDK, complete the standard setup first; the steps below only add offline configuration to your existing init.
2

Attach an offline config to AppSettings

Call setOfflineConfig(...) on the AppSettingsBuilder with an object whose enabled is true. Every other key has a sensible default, so set only what you need. To enable with all defaults, use the offline(true) shorthand instead.
Offline turns on only for an explicit enabled: true. A config object without enabled leaves it off. If you call both setOfflineConfig(...) and offline(...), the explicit config wins.
3

Initialize the SDK

Pass the settings to CometChat.init(...) as you do today. No other call changes.
4

Verify it is active

Call CometChat.isOfflineEnabled(). It returns true only while offline support is actually running for the logged-in user — so it is false before anyone logs in (even when you enabled it in AppSettings), after logout or session expiry, while the local store is still opening, and when the encrypted cache cannot open. Read it at the moment of each decision and keep no copy of the result.

Supported runtimes

Where IndexedDB is missing or blocked (for example some private-browsing modes), offline stays off for the session and the SDK works online as before.
Electron setup. Install the optional peer dependencies electron and better-sqlite3-multiple-ciphers, call registerOfflineIpc() from @cometchat/chat-sdk-javascript/electron/main in the main process, and installCometChatBridge() from @cometchat/chat-sdk-javascript/electron/preload in your preload script (with contextIsolation: true). Browser apps need nothing extra.

Next steps

Offline support is now active for the logged-in user. Continue with Show Cached Data to adopt the fetch listeners, and Send While Offline for the durable outbox. Tune caps, TTLs, media, and encryption from the Configuration & API Reference.