Created
August 5, 2021 11:35
-
-
Save swahaniroy/41459f67115c6c6dfe2d724eee88f17e to your computer and use it in GitHub Desktop.
Initializing CometChat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { enableProdMode } from '@angular/core'; | |
| import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | |
| import { AppModule } from './app/app.module'; | |
| import { environment } from './environments/environment'; | |
| import { CometChat } from "@cometchat-pro/chat"; | |
| import { COMETCHAT_CONSTANTS } from "./CONSTS"; | |
| if (environment.production) { | |
| enableProdMode(); | |
| } | |
| const appSetting = new CometChat.AppSettingsBuilder() | |
| .subscribePresenceForAllUsers() | |
| .setRegion(COMETCHAT_CONSTANTS.REGION) | |
| .build(); | |
| CometChat.init(COMETCHAT_CONSTANTS.APP_ID, appSetting).then( | |
| () => { | |
| console.log("CometChat initialized successfully"); | |
| platformBrowserDynamic() | |
| .bootstrapModule(AppModule) | |
| .catch((err) => console.error(err)); | |
| }, | |
| (error) => { | |
| console.log("CometChat initialization failed with error:", error); | |
| // Check the reason for error and take appropriate action. | |
| } | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment