---
source_url: https://www.pubnub.com/docs/chat/chat-sdk/learn/chat-entities/chat
title: Chat object
updated_at: 2026-04-01T14:49:07.000Z
---

# Chat object

## Documentation index

To discover more PubNub resources:

1. Fetch [PubNub's llms.txt](https://www.pubnub.com/llms-full.txt) for a list of available pages in Markdown format.
2. Identify relevant URLs from that index.
3. Fetch the target pages.

Do not assume a path exists, always check the index first.

The `Chat` object is your entry point to the Chat SDK after [initialization](https://www.pubnub.com/docs/chat/chat-sdk/build/configuration.md). Use the `Chat` object to create and manage channels, users, messages, memberships, and other entities.

Key capabilities:

* Create and delete channels and users
* Track user presence across channels
* Send custom events
* Access the underlying JavaScript SDK

## Properties

The `Chat` object has the following properties:

```ts
class Chat {
    sdk: PubNub,
    config: ChatConfig,
    mutedUsersManager: MutedUsersManager
}
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| sdk | PubNub | Optional |  | `sdk` lets you access any [JavaScript SDK](https://www.pubnub.com/docs/sdks/javascript.md) method. For example, if you want to call a method available in the App Context API, you'd use [chat.sdk.objects.getAllUUIDMetadata()](https://www.pubnub.com/docs/sdks/javascript/api-reference/objects.md#user). |
| config | ChatConfig | Optional |  | `ChatConfig` contains chat app configuration settings, such as `saveDebugLog` or `typingTimeout` that you provide when initializing your chat app with the [init()](https://www.pubnub.com/docs/chat/chat-sdk/build/configuration.md#initialize-pubnub) method. You can later directly access these properties, like: `chat.storeUserActivityInterval`. |
| mutedUsersManager | MutedUsersManager | Optional |  | Manages the client-side muted users list. Available when [syncMutedUsers](https://www.pubnub.com/docs/chat/chat-sdk/build/configuration.md#sync-muted-users) is enabled. |

`ChatConfig` includes these properties:

```ts
type ChatConfig = {
    // For logging errors
    saveDebugLog: boolean;
    // For typing indicator
    typingTimeout: number;
    // Two properties for enabling user's global presence & for tracking the user's last online activity
    storeUserActivityInterval: number;
    storeUserActivityTimestamps: boolean;
    // For push notifications
    pushNotifications: {
        sendPushes: boolean;
        deviceToken?: string;
        deviceGateway: "apns2" | "gcm";
        apnsTopic?: string;
        apnsEnvironment: "development" | "production";
    };
    // Two properties for client-side rate limiting (message spam prevention)
    rateLimitFactor: number;
    rateLimitPerChannel: {
        [key in ChannelType]: number;
    };
    // Controls whether read receipt events are emitted automatically
    emitReadReceiptEvents?: { direct?: boolean; group?: boolean; public?: boolean; unknown?: boolean };
    errorLogger?: ErrorLoggerImplementation;
```

To initialize the Chat SDK, you must provide three parameters: `publishKey`, `subscribeKey`, and `userId`, while all other settings (mentioned above) are optional. Read the [Configuration](https://www.pubnub.com/docs/chat/chat-sdk/build/configuration.md) page for details.

## Methods

You can call the following methods on the `Chat` object.

### Regular methods

* [createUser()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/create.md)
* [createDirectConversation()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/create.md#create-direct-channel)
* [createGroupConversation()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/create.md#create-group-channel)
* [createPublicConversation()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/create.md#create-public-channel)
* [(getter) currentUser](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/details.md#get-current-user)
* [deleteChannel()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/delete.md)
* [deleteUser()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/delete.md)
* [destroy()](https://www.pubnub.com/docs/chat/chat-sdk/build/configuration.md#destroy-chat-instance)
* [downloadDebugLog()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/error-logging.md#download-error-log)
* [fetchUnreadMessagesCounts()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/unread.md#get-unread-messages-count-all-channels)
* [getChannel()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/details.md)
* [getChannelGroup()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/channel-groups.md#get-channel-group-reference)
* [getChannels()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/list.md)
* [getChannelSuggestions()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/references.md#get-channel-suggestions)
* [getCurrentUserMentions()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/mentions.md#collect-all-user-related-mentions)
* [getEventsHistory()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/custom-events.md#get-historical-events)
* [getPushChannels()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/push-notifications.md#list-all-push-channels)
* [getUser()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/details.md#get-user-details)
* [getUsers()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/list.md)
* [getUserSuggestions()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/mentions.md#get-user-suggestions)
* [init()](https://www.pubnub.com/docs/chat/chat-sdk/build/configuration.md#initialize-pubnub)
* [isPresent()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/presence.md#check-users-channel-presence)
* [markAllMessagesAsRead](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/unread.md#mark-messages-as-read-all-channels)
* [registerPushChannels()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/push-notifications.md#register-selected-push-channels)
* [removeChannelGroup()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/channel-groups.md#remove-channel-group)
* [setRestrictions()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/moderation.md#mute-or-ban-users)
* [unregisterPushChannels()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/push-notifications.md#unregister-selected-push-channels)
* [unregisterAllPushChannels()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/push-notifications.md#unregister-all-push-channels)
* [updateChannel()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/updates.md#update-channel-details)
* [updateUser()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/updates.md#update-user-details)
* [wherePresent()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/presence.md#return-channels-where-user-is-present)
* [whoIsPresent()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/presence.md#return-all-users-present-on-channel)
* emitEvent() (deprecated)

### Event listeners

* [addConnectionStatusListener()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/connection-management.md)
* [disconnectSubscriptions()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/connection-management.md)
* [reconnectSubscriptions()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/connection-management.md)
* listenForEvents() (deprecated)

## Use case

For example, you can use the `Chat` object methods to:

* Create a [channel](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/create.md) or [user](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/create.md).
* Get [channel](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/details.md) or [user](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/details.md#get-user-details) data.

Last updated at: 2026-04-01T14:49:07.000Z
