Skip to content

Instantly share code, notes, and snippets.

@hieptlccc
Created January 9, 2022 07:02
Show Gist options
  • Save hieptlccc/5c2aba4ac1170d99dfece6022543fbcf to your computer and use it in GitHub Desktop.
Save hieptlccc/5c2aba4ac1170d99dfece6022543fbcf to your computer and use it in GitHub Desktop.
app.js - init cometchat - webex clone
...
const initCometChat = async () => {
const { CometChat } = await import('@cometchat-pro/chat');
const appID = `${process.env.REACT_APP_COMETCHAT_APP_ID}`;
const region = `${process.env.REACT_APP_COMETCHAT_REGION}`;
const appSetting = new CometChat.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion(region).build();
CometChat.init(appID, appSetting).then(
() => {
setCometChat(() => CometChat);
},
error => {
}
);
};
useEffect(() => {
initCometChat();
...
}, []);
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment