Logging Out

Last Edit: Mar 03 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()
                    

client.disconnect()
client.setUser(User("bender"), "{{ chat_user_token }}")
                    

await client.disconnect();

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