After being logged in with CometChat for a longer period of time we have experienced it not working any more. If we log out of our app and then log back in our app (this also means logging back into CometChat - CometChat.init ad CometChat.login …) everything works again.
The SDK stores the last logged in user in local storage. Every time a user loads your website you first have to initialize the SDK and then check what CometChat.getLoggedInUser() returns.
User Object=> It means that user is logged in and you can go ahead without calling the CometChat.login().
null=> It means there is no logged in user and you have to log in the user using CometChat.login().
Also, please note that if you clear the browser local storage then CometChat.getLoggedInUser() will return null. The storage is only cleared when you logout from CometChat. Hope this helps!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.