Client Setup

LAST EDIT Oct 08 2021
These docs are deprecated and will be removed from the site in the near future. Refer to the most up to date version of the iOS UI Component SDK,

Basic setup


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


Connection is handled automatically. However if you disconnect manually, 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


1. Enable logs


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


3. Setup a custom dispatch queue for responses:


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

4. App in the background behavior


The chat client stays connected in the background. You can change this behavior via `ChatClientConfig`