Logging Out

Last Edit: Sep 25 2020

To disconnect a user (say that you’re for instance logging out and logging in as someone new) you can call the disconnect method and repeat the setUser call as someone else:


client.disconnect();
client.setUser(
    {
        id: 'jack',
        name: 'Jack Doe',
    },
    'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiamxhaGV5In0.OkDbpbujWJ-XIVHaf00Dnqt3v8Yp_nQ6CGzm-Z4QUVc',
);
                    

client.disconnect();
                    

Client.shared.disconnect()
// Then you can call set(user:token:) as usual
                    

client.disconnect();
client.setUser(user, token, null);
                    

await client.disconnect();

await client.setUser(otherUser, "{{ chat_user_token }}");
                    

Disable Push Notifications

Additionally, you'll want to stop the user from receiving further push notifications by unregistering their device.