connectUser

fun connectUser(user: User, tokenProvider: TokenProvider, timeoutMilliseconds: Long? = null): Call<ConnectionData>

Initializes ChatClient for a specific user. 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 performs required operations before connecting with the Stream API. Moreover, it warms up the connection, sets up notifications, and connects to the socket.

Check out docs for more info about tokens. Also visit this site to find more about Json Web Token standard. You can generate the JWT token on using one of the available libraries or use our manual tool for token generation.

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 connectUser(user: User, token: String, timeoutMilliseconds: Long? = null): Call<ConnectionData>

Initializes ChatClient for a specific user using the given user token. Check ChatClient.connectUser with TokenProvider parameter for advanced use cases.

Return

Executable Call responsible for connecting the user.

Parameters

user

Instance of User type.

token

Instance of JWT token.