Skip to main content
Prerequisites: npm 8+, Node.js 16+, React Native 0.63+, credentials from CometChat Dashboard

Prerequisites

Get your credentials from the CometChat Dashboard:
  • App ID
  • Region
  • Auth Key (for development)
Auth Key is for development/testing only. In production, generate Auth Tokens on your server using the REST API. Never expose Auth Keys in production client code.
Migrating from v3 to v4? Your existing v3 app can be migrated directly — no need to create a new app. Follow the installation steps below to upgrade to the latest version of v4.

Installation

The React Native SDK requires async-storage as a peer dependency:
Android only: @react-native-async-storage/async-storage v3 ships a local Maven artifact. Add this to your android/build.gradle or the Android build will fail:

Voice & Video Calling (Optional)

v2.4+ onwards, calling functionality lives in a separate package. Install it only if you need voice/video:
Required additional dependencies for calling:
Add permissions to your AndroidManifest.xml:
Add the CometChat Maven repository to your project-level build.gradle:
Ensure minSdkVersion is set to 24 in the buildscript ext block:

Initialization

The init() method initializes the SDK and must be called before any other CometChat method. Call it once at app startup, typically in App.tsx.
Replace APP_ID and APP_REGION with your credentials from the Dashboard.
CometChat.init() must be called before any other SDK method. Calling login(), sendMessage(), or registering listeners before init() will fail.

Parameters

AppSettings Options

Presence Subscription

Choose how to subscribe to user presence (online/offline status):
See User Presence for more details.

WebSocket Connection

By default, the SDK manages WebSocket connections automatically. To manage them manually:
See Managing WebSocket Connections for manual control.

Next Steps

Authentication

Log in users with Auth Key or Auth Token

Send Messages

Send your first message