> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Offline Support

> Show cached chats and messages without a network and queue messages to send on reconnect with the CometChat Angular UI Kit.

> [accordion] AI Integration Quick Reference
>
> | Field | Value |
> | - | - |
> | Package | `@cometchat/chat-uikit-angular` 5.3.0 or later |
> | Chat SDK | `@cometchat/chat-sdk-javascript` 4.3.1 or later |
> | Default | Off. Nothing changes until you turn it on |
> | Enable | `new UIKitSettingsBuilder().setOfflineConfig({ enabled: true })` before `CometChatUIKit.init(UIKitSettings)` |
> | Config type | `CometChatOfflineConfig`. Passed to the Chat SDK unchanged. Options: [OfflineConfig options](https://www.cometchat.com/docs/sdk/javascript/offline-reference.md#offlineconfig-options) |
> | Runtime check | `CometChat.isOfflineEnabled()`. The UI Kit reads it every time, not your config |
> | Inputs | `hideOfflineNotices` on `cometchat-message-list` and `cometchat-conversations` |
> | Events | `CometChatMessageEvents.ccMessageSendStateChanged`, `CometChatMessageEvents.ccOfflineCacheReset` |
> | Service signals | `connectToSearch`, `searchFailed`, `reconnectSearchError$` on `SearchConversationsService` and `SearchMessagesService` |
> | Component method | `CometChatMessageListComponent.retryOfflineRead()` |
> | Option ids | `CometChatUIKitConstants.MessageOption.retryMessage`, `CometChatUIKitConstants.MessageOption.discardMessage` |
> | Quiet rejection | `CometChatUIKit.sendTextMessage()` / `sendMediaMessage()` / `sendCustomMessage()` for a queued message rejects with code `ERROR_OFFLINE_MESSAGE_DISCARDED` when the message is removed before it sends: logout, user switch, cache reset, the user's **Delete**, or the outbox discarding it |

## Overview

With offline support on, the UI Kit keeps working when the network drops. The [JavaScript Chat SDK](https://www.cometchat.com/docs/sdk/javascript/offline-overview.md) keeps a cache on the device and an outbox of unsent messages. The UI Kit components read from that cache first, show each message's send state, and catch up when the connection returns.

**Works offline:**

* Conversations, users, groups, group members, messages, threads, reactions, the notification feed, and pinned and saved messages that the user has already loaded appear at once from the device.
* Text, media and custom messages can be sent. They are queued and go out by themselves when the connection returns. Photos, videos, audio files and documents picked in the composer are queued the same way; a file larger than the offline media budget is not queued and shows **File too large to send offline**.
* Unsent messages can be retried or deleted.
* Media the SDK has saved on the device plays and opens from the device.

**Needs a connection:**

* The first load of anything the user has never opened while online.
* A keyword search with no saved match.
* Editing, deleting, reacting to, pinning or saving a sent message. These are not queued.
* Message information, calls, and AI agent streamed replies.

## Requirements

| Requirement | Version |
| - | - |
| Angular UI Kit | `@cometchat/chat-uikit-angular` **5.3.0** or later (v5 only) |
| Chat SDK | `@cometchat/chat-sdk-javascript` **4.3.1** or later |

The UI Kit's peer dependency on the Chat SDK stays `^4.2.0`, so upgrading the UI Kit does not force an SDK upgrade, and **npm does not enforce the 4.3.1 requirement**. With SDK 4.2.x or 4.3.0, `setOfflineConfig()` is ignored and the UI Kit works online only, with no error and no warning. The UI Kit needs the `SCHEMA_RESET` cache-reset reason, which first ships in 4.3.1. If offline support appears to do nothing, check `npm ls @cometchat/chat-sdk-javascript`, or call `CometChat.isOfflineEnabled()` after login. Install SDK 4.3.1 or later to use offline support:

```bash theme={null}
npm install @cometchat/chat-uikit-angular@^5.3.0 @cometchat/chat-sdk-javascript@^4.3.1
```

The browser needs IndexedDB for the cache. Where it is missing or blocked (for example, in some private-browsing modes), offline support stays off for that session. See [Supported runtimes](https://www.cometchat.com/docs/sdk/javascript/offline-enable.md#supported-runtimes).

> [!NOTE]
>
> UI Kit v4 has no offline support. Turning on the SDK's offline support under UI Kit v4 is not supported.

## Enable Offline Support

Offline support is **off by default**. Call `setOfflineConfig()` on the `UIKitSettingsBuilder` with `enabled: true`, before `CometChatUIKit.init()`. The UI Kit passes the object to the Chat SDK's `AppSettingsBuilder.setOfflineConfig()` unchanged.

```ts title="src/main.ts" expandable theme={null}
import { bootstrapApplication } from "@angular/platform-browser";
import { App } from "./app/app";
import { appConfig } from "./app/app.config";
import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-angular";

const UIKitSettings = new UIKitSettingsBuilder()
  .setAppId("APP_ID")
  .setRegion("REGION")
  .setAuthKey("AUTH_KEY")
  .subscribePresenceForAllUsers()
  .setOfflineConfig({
    enabled: true,
    // Any other OfflineConfig option, for example:
    // encryption: true,
    // maxPendingMessages: 50,
  })
  .build();

CometChatUIKit.init(UIKitSettings)
  ?.then(() => {
    bootstrapApplication(App, appConfig).catch((err) => console.error(err));
  })
  .catch((error) => {
    console.error("CometChat UI Kit initialization failed:", error);
  });
```

The config is typed as `CometChatOfflineConfig`. It lists exactly the SDK's options, so a misspelled key such as `enable` is a compile error. For what each option does and its default, see [OfflineConfig options](https://www.cometchat.com/docs/sdk/javascript/offline-reference.md#offlineconfig-options). For encryption and media caching, see [Encrypt the Cache](https://www.cometchat.com/docs/sdk/javascript/offline-encryption.md) and [Media Caching](https://www.cometchat.com/docs/sdk/javascript/offline-media-caching.md).

> [!NOTE]
>
> Offline support turns on only with an explicit `enabled: true`. A config without `enabled` leaves it off.

Whether offline support is running can change after init: it is off before anyone logs in, and the SDK can turn it off, for example when the encrypted cache cannot open. The components check `CometChat.isOfflineEnabled()` each time they need to. Do the same in your own code instead of reading back the config you passed. See [Verify it is active](https://www.cometchat.com/docs/sdk/javascript/offline-enable.md).

## How the Components Behave Offline

### Lists

This applies to [Conversations](https://www.cometchat.com/docs/ui-kit/angular/components/cometchat-conversations.md), [Users](https://www.cometchat.com/docs/ui-kit/angular/components/cometchat-users.md), [Groups](https://www.cometchat.com/docs/ui-kit/angular/components/cometchat-groups.md), [Group Members](https://www.cometchat.com/docs/ui-kit/angular/components/cometchat-group-members.md), [Reaction List](https://www.cometchat.com/docs/ui-kit/angular/components/cometchat-reaction-list.md), [Notification Feed](https://www.cometchat.com/docs/ui-kit/angular/components/notification-feed.md), [Pinned Messages](https://www.cometchat.com/docs/ui-kit/angular/components/cometchat-pinned-messages.md) and [Saved Messages](https://www.cometchat.com/docs/ui-kit/angular/components/cometchat-saved-messages.md).

* **Saved rows first.** The list paints the rows saved on the device straight away, then merges in the server page when it arrives.
* **Offline with nothing saved.** The list shows its offline state: an icon and **Connect to load chats** (or users, groups, members, reactions, notifications, messages), with no Retry button. It loads once by itself when the connection comes back after a drop the SDK reported. If the app started with no connection at all, only the Message List loads by itself; these lists load the next time they are opened.
* **Rows on screen stay.** If a load fails while rows are showing, the rows stay and nothing is drawn over them.
* **Reaction counts.** Offline with no reactions loaded, the Reaction List shows **Connect to load reactions** and keeps its tabs, with the counts the message already carries.
* **Reconnect.** The SDK catches every list up. The Message List and Conversations make no refresh fetch of their own, apart from the one-time reads above. Users, Groups and Group Members quietly re-read their first page, as they do with offline support off. Messages that arrived meanwhile appear without a sound and without extra unread counts.

### Search

* **Keyword search.** A search with a keyword that cannot reach the server, and has no saved match, shows **Connect to search** with a second line, **Search needs an internet connection.** It runs again once by itself when the connection comes back after a drop the SDK reported; after a start with no connection at all, run the search again.
* **Filters only.** A list opened with a filter and no keyword (online users, tags, a request builder with no search term) is a plain list, not a search. Offline with nothing saved, it shows that list's **Connect to load …** text.
* **The [Search](https://www.cometchat.com/docs/ui-kit/angular/components/cometchat-search.md) component** searches conversations and messages together:
  * It shows **Connect to search** only when every failed request was a not-connected one.
  * A search by filters alone is answered from the device. When nothing is saved, it shows the plain empty state (**No Results**), not **Connect to search**.
  * It waits for both scopes before it treats a failure as an error. See [Errors and Callbacks](#errors-and-callbacks).

### Message List and Threads

[Message List](https://www.cometchat.com/docs/ui-kit/angular/components/cometchat-message-list.md) behaves as follows:

* **Cached history.** A chat opens with the messages saved on the device, then updates with the server page. A chat opened offline with nothing saved shows **Connect to load messages**.
* **Connect to load more.** Offline, scrolling past the saved messages shows a tappable **Connect to load more** row at that edge: at the top for older messages, at the bottom for newer ones. The list never ends there. When the connection is back, the page behind the row loads once by itself, older edge first. Tapping the row or scrolling to that end also loads it.
* **Jump to a message.** A saved target opens with the saved messages around it.
  * When the chat opens on a target (`goToMessageId`, or the unread anchor) that is neither saved nor reachable offline, it opens on its newest saved page as a normal offline open, with no error.
  * From messages already on screen (a quoted reply, a search result), the messages on screen stay until the target is found. If it cannot be read offline, nothing changes and nothing is reported.
  * If the target cannot be read for another reason, for example it was deleted, `(error)` fires once. The messages on screen stay, or an opening chat shows its newest page; with nothing to show, the error view shows.
* **Start from unread.** With `startFromUnreadMessages`, the chat opens on its newest page from the device, then moves to the unread divider.
* **Threads.** A thread view shows the same offline states as the main list. See [Limitations](#limitations) for what is saved for threads.

> [!NOTE]
>
> The message list's default request lets the SDK save each page for offline use. If you pass your own `messagesRequestBuilder` with extra filters, the request is sent exactly as you built it. The SDK may then not save its pages, so that chat has less to show offline. See [Cache-supported filters](https://www.cometchat.com/docs/sdk/javascript/offline-reference.md#cache-supported-filters).

### Composer and Sending

[Message Composer](https://www.cometchat.com/docs/ui-kit/angular/components/cometchat-message-composer.md) and Message List handle sends as follows:

* **Queued sends.** A message sent offline appears at once with a clock icon and **Not sent yet**. It is queued, not failed, and sends by itself when the connection returns.
* **Failed sends.** A message the server refuses shows the error mark and **Not sent. Tap to retry**, whatever the reason. A failed message stays failed until the user taps it or chooses **Retry**.
* **Retry and Delete.** Every own message that is waiting, sending, or failed offers only **Retry** and **Delete** in its menu. Reply, thread, react, edit, pin, save, info and copy all need a sent message, so they are hidden until it is sent.
  * **Delete** shows the usual confirmation, then removes the message from this device for good, offline too, and it stays removed after a restart.
  * Retry or Delete on a message whose send is already under way changes nothing, and a short **Sending… try again in a moment** notice shows.
  * If the SDK no longer holds an unsent message (for example, its chat was removed from the cache), Retry or Delete removes it from the screen.
* **Queue limits.** When the outbox is full (`maxPendingMessages`), the message shows as not sent with the notice **Too many messages waiting to send**. Retry sends it once there is room.
* **Editing.** An edit is sent straight to the server and is never queued. When it fails, for example offline, the composer has already left edit mode and cleared, and the error goes to the composer's `(error)` output.

For how the SDK queues sends, see [Send While Offline](https://www.cometchat.com/docs/sdk/javascript/offline-send.md).

### Media

* Images, videos, audio, voice notes and files the SDK has saved open and play from the device when offline. By default the SDK saves incoming media as it arrives; with `mediaCaching` set to `OFF` it saves none and the UI Kit loads media from its URL. See [Media Caching](https://www.cometchat.com/docs/sdk/javascript/offline-media-caching.md).
* An image, video, audio file or file with no saved copy shows **Available when online** while offline.
* Online, tapping an image, video or file the device has no copy of downloads and caches it. Playing an audio file does the same; the audio plays from its URL and uses the saved copy next time.

### Edits, Deletes and Reactions

Editing, deleting, reacting to, pinning and saving a **sent** message need a connection. They are not queued: offline, each one fails with the SDK's not-connected error. Edits, deletes and reactions made on other devices sync in when the connection returns.

### Presence

Nobody shows as online while the connection is down, in any list or header, and screen readers do not announce anyone as online. Presence comes back with the connection.

### Logout and Switching Users

The cache belongs to one user. Logging out, a session expiring, or logging in as a different user deletes the cache, including any unsent messages. You don't clear anything yourself. See [One cache per user](https://www.cometchat.com/docs/sdk/javascript/offline-overview.md#one-cache-per-user).

## Offline States and Texts

These are the texts the components show in their offline states. Each one is a localization key, so you can change the text with `CometChatLocalize.addTranslation()`, as for any other string. See [Localization](https://www.cometchat.com/docs/ui-kit/angular/customization/localization.md).

| Text | Where it appears | Key |
| - | - | - |
| Connect to load chats | Conversations | `conversations_connect_to_load` |
| Connect to load users | Users | `users_connect_to_load` |
| Connect to load groups | Groups | `groups_connect_to_load` |
| Connect to load members | Group Members | `group_members_connect_to_load` |
| Connect to load messages | Message List, threads, Pinned Messages, Saved Messages | `message_list_connect_to_load` |
| Connect to load reactions | Reaction List | `reaction_list_connect_to_load` |
| Connect to load notifications | Notification Feed | `notification_feed_connect_to_load` |
| Connect to search | Searchable lists | `conversations_connect_to_search` |
| Connect to search | Search component | `search_connect_to_search_messages` |
| Search needs an internet connection. | Second line under **Connect to search** | `list_connect_to_search_subtitle` |
| Connect to load more | Message List edge row | `message_list_connect_to_load_more` |
| Not sent yet | Unsent own message | `message_list_not_sent_yet` |
| Not sent. Tap to retry | Failed own message | `message_list_not_sent_tap_to_retry` |
| Sending… try again in a moment | Retry or Delete during a send | `message_list_send_in_flight` |
| Too many messages waiting to send | Outbox full | `message_list_queue_full` |
| Available when online | Image, video, audio or file with no saved copy | `message_bubble_media_available_when_online` |
| 1 unsent message was removed | Message List notice | `message_list_unsent_message_removed` |
| `{{count}}` message wasn't sent | Message List notice | `message_list_messages_not_sent_one`, `message_list_messages_not_sent_other` |
| `{{count}}` unsent message couldn't be recovered | Cache reset notice | `message_list_unsent_messages_lost_one`, `message_list_unsent_messages_lost_other` |
| Some unsent messages may not have been sent | Cache reset notice | `message_list_unsent_messages_maybe_lost` |
| File too large to send offline | Message List notice, when a picked file exceeds the offline media budget | `message_list_file_too_large_offline` |

The counted notices use plural keys: `_one` and `_other`, plus `_few` and `_many` in languages that need them. The UI Kit picks the form for the current language and falls back to `_other`, replacing `{{count}}` with the number.

```typescript theme={null}
import { CometChatLocalize } from "@cometchat/chat-uikit-angular";

CometChatLocalize.addTranslation({
  "en-US": {
    "conversations_connect_to_load": "You're offline. Reconnect to see your chats.",
    "message_list_connect_to_load_more": "Reconnect to load more",
  },
});
```

## Errors and Callbacks

### The error output

The list components' `(error)` output follows one rule while offline support is on:

| Situation | What shows | `(error)` |
| - | - | - |
| Offline, nothing on screen | The offline state (**Connect to load …**), or your `errorView` if you passed one | Fires once |
| Keyword search offline, no saved match | **Connect to search** | Does not fire |
| Online, a real error, nothing on screen | The error view with Retry, or your `errorView`. Not reloaded by itself | Fires once |
| Rows on screen, offline | Rows stay | Does not fire |
| Rows on screen, online, a load the user or app started (opening, refresh, search, filter, paging, jump to a message, Retry) | Rows stay | Fires once |
| Rows on screen, online, a load the UI Kit started (reconnect, sync, cache reset) | Rows stay | Does not fire |
| The server answers with an empty list | The empty view, or your `emptyView` | Does not fire |

The Search component reports through its `(searchError)` output instead. With both scopes:

* If both scopes fail, at least one for a real reason, the error view shows and `(searchError)` fires once for each scope that failed for a real reason.
* If one scope fails and the other has results, the results stay and `(searchError)` fires once for the failed scope if it failed for a real reason.
* If one scope fails and nothing is shown, the plain empty state (**No Results**, or your own empty view) shows, with no `(searchError)` and no run on reconnect.

### Send promises

`CometChatUIKit.sendTextMessage()`, `sendMediaMessage()` and `sendCustomMessage()` behave as follows when offline support is on:

* They resolve when the message is sent.
* They reject on a final failure.
* They never reject only because the message was queued.
* Any removal of the message before it is sent rejects the promise once, quietly, with the code `ERROR_OFFLINE_MESSAGE_DISCARDED`: a logout or user switch, a cache reset that lost (or may have lost) unsent messages, the user's own **Delete**, and the outbox discarding the message (for example under a drop-oldest overflow policy). The code is always `ERROR_OFFLINE_MESSAGE_DISCARDED`, whatever the reason; the reason itself is not exposed on the rejection. The components show no error for it. Treat it as "dropped", not as a failure to report.

```typescript theme={null}
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatUIKit } from "@cometchat/chat-uikit-angular";

const message = new CometChat.TextMessage("UID", "Hello", CometChat.RECEIVER_TYPE.USER);

CometChatUIKit.sendTextMessage(message)
  .then((sent) => console.log("Sent", sent))
  .catch((error) => {
    if (error?.code === "ERROR_OFFLINE_MESSAGE_DISCARDED") return; // removed before sending (logout, cache reset, Delete, outbox discard)
    console.error("Send failed", error);
  });
```

See [Error codes](https://www.cometchat.com/docs/sdk/javascript/offline-reference.md#error-codes) for the other offline codes.

### Events

Two events on `CometChatMessageEvents` fire only while offline support is on:

| Event | Payload | When |
| - | - | - |
| `ccMessageSendStateChanged` | `IMessageSendStateChanged`: `{ message, state, reason? }`, where `state` is `MessageSendState`: `'sending'`, `'sent'`, `'failed'` or `'discarded'`. `reason` is the SDK's failure reason for `failed` and `discarded` | Once per send-state change of an own message |
| `ccOfflineCacheReset` | `IOfflineCacheReset`: `{ reason, pendingMessagesLost }`, where `pendingMessagesLost` is `null` when the SDK cannot know | The SDK rebuilt its offline cache. The lists reload |

```typescript theme={null}
import { Component, DestroyRef, OnInit, inject } from "@angular/core";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import {
  CometChatMessageEvents,
  IMessageSendStateChanged,
  IOfflineCacheReset,
} from "@cometchat/chat-uikit-angular";

@Component({ selector: "app-offline-log", standalone: true, template: "" })
export class OfflineLogComponent implements OnInit {
  private destroyRef = inject(DestroyRef);

  ngOnInit(): void {
    CometChatMessageEvents.ccMessageSendStateChanged
      .pipe(takeUntilDestroyed(this.destroyRef))
      .subscribe(({ message, state, reason }: IMessageSendStateChanged) => {
        console.log("Send state", message.getMuid(), state, reason);
      });

    CometChatMessageEvents.ccOfflineCacheReset
      .pipe(takeUntilDestroyed(this.destroyRef))
      .subscribe(({ reason, pendingMessagesLost }: IOfflineCacheReset) => {
        console.log("Cache reset", reason, pendingMessagesLost);
      });
  }
}
```

`ccMessageSent` keeps its contract: one `inprogress`, then one `success` or `error` per message. A queued message stays `inprogress` until it is sent.

> [!WARNING]
>
> **Group events can come from catch-up.** With offline support on, group actions that happened while the user was away (a kick, a ban, a scope change, or the user leaving from another device) arrive in the SDK's catch-up. The UI Kit then also emits `CometChatGroupEvents.ccGroupMemberKicked`, `ccGroupMemberBanned`, `ccGroupMemberScopeChanged` and `ccGroupLeft`, with the same payload as before. These events no longer always mean "this user just did it". Check `kickedBy` or `message.getActionBy()` before you show a toast for the user's own action, and handle the case where the kicked user is the signed-in user, for example by closing the chat.

### Search service signals

[`SearchConversationsService`](https://www.cometchat.com/docs/ui-kit/angular/api-reference/search-conversations-service) and [`SearchMessagesService`](https://www.cometchat.com/docs/ui-kit/angular/api-reference/search-messages-service) expose offline state as signals. Both are always `false` while offline support is off.

| Member | Type | Meaning |
| - | - | - |
| `connectToSearch` | `WritableSignal<boolean>` | `true` when a keyword search could not reach the server and nothing saved matches. `fetchState` is `empty`, `search()` does not reject, and the search runs once more by itself when the connection comes back after a drop the SDK reported. |
| `searchFailed` | `WritableSignal<boolean>` | `true` when a search inside the Search component failed with a real error and nothing is shown. `fetchState` is `empty` and the Search component decides, once both scopes answer, whether to show the error view or the empty state. Always `false` when you use the service outside the Search component. |
| `reconnectSearchError$` | `Subject<CometChat.CometChatException>` | Emits when the search the service re-ran by itself on reconnect fails. A search you start rejects to you instead. |

```typescript theme={null}
import { Component, computed, inject } from "@angular/core";
import { SearchConversationsService } from "@cometchat/chat-uikit-angular";

@Component({
  selector: "app-conversation-search",
  standalone: true,
  providers: [SearchConversationsService],
  template: `
    <input #q (keyup.enter)="run(q.value)" />
    @if (offlineMiss()) {
      <p>Connect to search</p>
    }
  `,
})
export class ConversationSearchComponent {
  private search = inject(SearchConversationsService);
  offlineMiss = computed(() => this.search.connectToSearch());

  run(keyword: string): void {
    this.search.search(keyword, []).catch((error) => console.error(error));
  }
}
```

## Customization

### Hide the offline notices

`cometchat-message-list` and `cometchat-conversations` take a `hideOfflineNotices` input (default `false`):

| Component | Notices it hides |
| - | - |
| `cometchat-message-list` | All of its offline notices, including a message removed, messages not sent, the outbox full, a file too large to send offline, **Sending… try again in a moment**, and a cache reset (the message list shows cache reset notices only when no `cometchat-conversations` is on screen) |
| `cometchat-conversations` | The notice shown when the offline cache was reset and unsent messages were, or may have been, lost |

```html theme={null}
<cometchat-message-list [user]="user" [hideOfflineNotices]="true"></cometchat-message-list>
<cometchat-conversations [hideOfflineNotices]="true"></cometchat-conversations>
```

The input has no effect while offline support is off.

### Your own empty and error views

Your own views win over the built-in offline states:

* An `errorView` you pass to a list shows instead of **Connect to load …** (on the Notification Feed, `errorStateView`).
* An `emptyView` you pass to Conversations, Users, Groups or Group Members shows instead of **Connect to search**. It also shows when the server answers with an empty list, and in the Search component's plain empty state.
* On Conversations, Users, Groups, Group Members and Message List, `hideError` hides **Connect to load …** along with the error view.

### Your own "Connect to load more" control

The built-in **Connect to load more** row calls the message list's public `retryOfflineRead()` method, which reads the page behind the blocked edge. To trigger it from your own control, call it on a `viewChild` reference:

```typescript theme={null}
import { Component, viewChild } from "@angular/core";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageListComponent } from "@cometchat/chat-uikit-angular";

@Component({
  selector: "app-chat",
  standalone: true,
  imports: [CometChatMessageListComponent],
  template: `
    <cometchat-message-list #list [user]="user"></cometchat-message-list>
    <button (click)="loadMore()">Load more</button>
  `,
})
export class ChatComponent {
  user!: CometChat.User;
  private list = viewChild.required<CometChatMessageListComponent>("list");

  loadMore(): void {
    this.list().retryOfflineRead();
  }
}
```

### Message options on unsent messages

The **Retry** and **Delete** options on an unsent message use the ids `CometChatUIKitConstants.MessageOption.retryMessage` and `CometChatUIKitConstants.MessageOption.discardMessage`. Use them to find these options when you customize the message menu. `hideDeleteMessageOption` also hides **Delete** on unsent messages.

### Theming

The offline states use the theme's existing colors and fonts. Override them with these CSS variables:

| Variable | Default | Used for |
| - | - | - |
| `--cometchat-message-bubble-offline-pending-color` | `var(--cometchat-text-color-secondary)` | **Not sent yet** next to the clock |
| `--cometchat-message-bubble-offline-pending-font` | `var(--cometchat-font-caption1-regular)` | **Not sent yet** |
| `--cometchat-message-bubble-offline-retry-color` | `var(--cometchat-error-color)` | **Not sent. Tap to retry** |
| `--cometchat-message-bubble-offline-retry-font` | `var(--cometchat-font-caption1-regular)` | **Not sent. Tap to retry** |
| `--cometchat-message-bubble-offline-retry-focus-outline-color` | `var(--cometchat-primary-color)` | Keyboard focus ring on **Not sent. Tap to retry** |
| `--cometchat-message-bubble-offline-failed-tint` | `transparent` | Background of a failed unsent message |
| `--cometchat-message-bubble-offline-failed-icon-color` | `var(--cometchat-error-color)` | Failed mark on an unsent message |
| `--cometchat-message-list-offline-footer-color` | `var(--cometchat-primary-color)` | **Connect to load more** |
| `--cometchat-message-list-offline-footer-font` | `var(--cometchat-font-caption1-medium)` | **Connect to load more** |
| `--cometchat-message-list-offline-notice-background` | `var(--cometchat-background-color-02)` | Message list notices |
| `--cometchat-message-list-offline-notice-border` | `1px solid var(--cometchat-border-color-light)` | Message list notices |
| `--cometchat-message-list-offline-notice-color` | `var(--cometchat-text-color-primary)` | Message list notices |
| `--cometchat-message-list-offline-notice-font` | `var(--cometchat-font-caption1-regular)` | Message list notices |
| `--cometchat-conversations-offline-notice-background` | `var(--cometchat-background-color-02)` | Conversation list notice |
| `--cometchat-conversations-offline-notice-border` | `1px solid var(--cometchat-border-color-light)` | Conversation list notice |
| `--cometchat-conversations-offline-notice-color` | `var(--cometchat-text-color-primary)` | Conversation list notice |
| `--cometchat-conversations-offline-notice-font` | `var(--cometchat-font-caption1-regular)` | Conversation list notice |
| `--cometchat-conversations-receipt-error-color` | `var(--cometchat-error-color)` | Failed mark on a conversation's last-message preview |
| `--cometchat-image-bubble-offline-placeholder-color` | `var(--cometchat-text-color-secondary)` | **Available when online** on an image |
| `--cometchat-image-bubble-offline-placeholder-font` | `var(--cometchat-font-caption1-regular)` | **Available when online** on an image |
| `--cometchat-video-bubble-offline-placeholder-color` | `var(--cometchat-text-color-secondary)` | **Available when online** on a video |
| `--cometchat-video-bubble-offline-placeholder-font` | `var(--cometchat-font-caption1-regular)` | **Available when online** on a video |

```css theme={null}
.cometchat {
  --cometchat-message-list-offline-footer-color: #0b7bff;
  --cometchat-message-bubble-offline-failed-tint: rgba(244, 70, 73, 0.06);
}
```

See [Theming](https://www.cometchat.com/docs/ui-kit/angular/customization/theming.md) for where to put overrides.

## With Offline Support Turned Off

Apps that don't turn offline support on keep today's behavior: no cache, no outbox, no offline states, and neither offline event fires. UI Kit 5.3.0 still includes a few changes that apply with offline support off:

* **Behavior changes.** On reconnect, the conversation list keeps the freshly fetched copy of a row. A failed send shows the error mark rather than the clock. The server copy of your own message keeps its quote and thread-subscribed flag. A `messagesRequestBuilder` you pass is left unchanged by the UI Kit.
* **Send error metadata.** When `CometChatUIKit.sendTextMessage()`, `sendMediaMessage()` or `sendCustomMessage()` fails, `metadata.error` is merged into the message's existing metadata instead of replacing it, so your own metadata keys survive.
* **Test identifiers.** Message rows, the message menu, conversation rows, notices, the list footer, the composer input, attachment tray tiles, and the empty and error views carry `data-testid` and `data-cc-*` attributes. They hold no message text and are not read by screen readers, but DOM snapshot tests may change.
* **Bundle size.** Chat SDK 4.3 adds about 0.54 MB to an app's initial bundle, and UI Kit 5.3.0 about 0.12 MB, whether offline support is on or off.
* **Reconnect.** As in 5.2.x, the message list makes no fetch of its own on reconnect. Messages missed during a drop appear when the chat is reopened.
* **Browser connectivity events.** UI Kit 5.3.0 also treats the browser's `online` and `offline` events as connection changes. After a drop the SDK did not report, Conversations, Users, Groups and Group Members each re-read their first page once when the connection returns. Nothing is re-read while the SDK reports its socket as connected, and a drop before the first connect is ignored.

## Limitations

* The cache holds only what the user has loaded while online, plus what syncs on reconnect. A user who has never used the app online has nothing to show offline.
* Keyword search, message information, calls and AI agent streamed replies need a connection.
* Edits, deletes and reactions on sent messages are not queued offline. They need a connection when the user makes them.
* The browser cache encrypts message content but not lookup metadata, and downloaded media is stored unencrypted. See [What gets encrypted](https://www.cometchat.com/docs/sdk/javascript/offline-encryption.md#what-gets-encrypted).

***

## Next Steps

> [card] [SDK Offline Support](https://www.cometchat.com/docs/sdk/javascript/offline-overview.md)
>
> How the JavaScript SDK caches, queues and syncs

> [card] [Configuration & API Reference](https://www.cometchat.com/docs/sdk/javascript/offline-reference.md)
>
> Every OfflineConfig option, listener and error code

> [card] [Send While Offline](https://www.cometchat.com/docs/sdk/javascript/offline-send.md)
>
> The outbox, retry, discard and queue limits

> [card] [Stay in Sync](https://www.cometchat.com/docs/sdk/javascript/offline-sync.md)
>
> Catch-up on reconnect and cache resets

> [card] [Message List](https://www.cometchat.com/docs/ui-kit/angular/components/cometchat-message-list.md)
>
> Inputs, outputs and custom views

> [card] [Events](https://www.cometchat.com/docs/ui-kit/angular/events.md)
>
> All UI Kit events, including the offline ones


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.