talkjs/talkjs-examples

remove session when a user logs out in SPA without reloading

prakhar-pal opened this issue · 3 comments

Hi, I checked out example inside "react/marketplace/marketplace-with-chat" to know how to logout as a talkjs user. From what I understand, the application reloads itself after clearing its token and dispatching a logout event. This works, but I was wondering if there were a way to deactivate/un-register a session (from talkjs session object) without reloading the whole application.
PS: I tried using unregisterDevice() method on TalkJS session object but it didn't change the status to offiline ergo, a user in other browser session can still see this user as online. But reloading the browser window changes this user's status to offline.

Hi. We currently don't have a way to do that, but we have one in the works that should be released soon if everything goes according to plan.

Ok, thanks.

Hi - just a quick update. You should now be able to call session.destroy() to kill all active connections for the session. You may need to upgrade the talkjs npm package to version 0.9.1 to get type hints to work correctly.

See our documentation for more information on this method.