val user = User()
val token = "token"
client.disconnect(flushPersistence = false).enqueue { disconnectResult ->
if (disconnectResult.isSuccess) {
client.connectUser(user, token).enqueue { /* ... */ }
} else {
// Handle result.error()
}
}
Logging Out
User can be logged out by disconnecting the user. After disconnection, call connect user for logging in with another user.
await client.disconnectUser();
await client.connectUser(
{
id: "jack",
name: "Jack Doe",
},
"{{ chat_user_token }}",
);
// Disconnect from web-socket events, but keep the offline state
chatClient.disconnect {
// …
}
// or
await chatClient.disconnect()
// Disconnect from web-socket events and delete the offline state
chatClient.logout {
// …
}
// or
await chatClient.logout()
await client.disconnect();
await client.connectUser(otherUser, "{{ chat_user_token }}");
Client->DisconnectUser();
const FString Token{TEXT("{{ api_key }}")};
const FUser OtherUser{TEXT("tommaso")};
Client->ConnectUser(
OtherUser,
Token,
[](const FOwnUser& UserRef)
{
// New connection established
});
User user = new User();
String token = "token";
client.disconnect(true).enqueue(disconnectResult -> {
if (disconnectResult.isSuccess()) {
client.connectUser(user, token).enqueue(loginResult -> { /* ... */ });
} else {
// Handle result.error()
}
});
await client.DisconnectUserAsync();
Disable Push Notifications
Additionally, you’ll want to stop the user from receiving further push notifications by unregistering their device.
On this page: