Client Setup

LAST EDIT Jul 21 2021

Basic setup

Copied!

Setup Stream API key for the ChatClient in your AppDelegate.

Once set up, you cannot change the API key of the ChatClient.

The ChatClient 's TokenProvider can be set again later, but remember to call chatClient.currentUserController().reloadUserIfNeeded().

ℹ️ You can find how to setup a user here.

Connecting & Disconnecting

Copied!

Connection is handled automatically. However if you disconnect, you'll need to connect again. There's no need to set the token provider again.

Client.shared.disconnect() acts like the logout, it'll clear Client and logout the user. After this call, you should set user again to login & connect:

You do not need to disconnect when app is backgrounded, SDK takes care of background state.

Additional Parameters

Copied!

1. Enable logs

Copied!

By default logs are disabled.

You can enable it for requests and/or web socket events with different log levels (.error.debug, .info .warning).

⚠️ Using .info and .debug levels for production builds are not recommended.

ℹ️ You can find more info about logging you can find here.

2. You can specify a custom Stream BaseURL

Copied!

3. Setup a custom dispatch queue for responses:

Copied!

Dispatch queue for callbacks can be set for each controller individually.

4. App in the background behavior

Copied!

The chat client stays connected in the background. It's not possible to change this behavior at the moment.