init() method initializes the SDK and must be called before any other CometChat method. Call it once at app startup, typically in your entry file (index.js, main.js, or App.js).
Basic Initialization
- TypeScript
- JavaScript
APP_ID with your CometChat App ID and APP_REGION with your Region from the Dashboard.
Parameters
AppSettings Options
Presence Subscription
Choose how to subscribe to user presence (online/offline status):WebSocket Connection
By default, the SDK manages WebSocket connections automatically. To manage them manually:Session Storage
Use session storage instead of local storage (data clears when browser closes):Next Steps
Authentication
Log in users with Auth Key or Auth Token
SSR Compatibility
Setup for Next.js, Nuxt, and Ionic