switchUser

fun switchUser(user: User, tokenProvider: TokenProvider, timeoutMilliseconds: Long? = null, onDisconnectionComplete: () -> Unit = {}): Call<ConnectionData>

Changes the user. Disconnects the current user and connects to a new one. The tokenProvider implementation is used for the initial token, and it's also invoked whenever the user's token has expired, to fetch a new token.

This method disconnects from the SDK and right after connects to it with the new User.

Return

Executable Call responsible for connecting the user.

Parameters

user

The user to set.

tokenProvider

A TokenProvider implementation.

timeoutMilliseconds

The timeout in milliseconds to be waiting until the connection is established.

See also


fun switchUser(user: User, token: String, timeoutMilliseconds: Long? = null, onDisconnectionComplete: () -> Unit = {}): Call<ConnectionData>

Changes the user. Disconnects the current user and connects to a new one. The tokenProvider implementation is used for the initial token, and it's also invoked whenever the user's token has expired, to fetch a new token.

This method disconnects from the SDK and right after connects to it with the new User.

Return

Executable Call responsible for connecting the user.

Parameters

user

The user to set.

token

Instance of JWT token.

timeoutMilliseconds

The timeout in milliseconds to be waiting until the connection is established.

See also