ChatClient
The ChatClient is the main entry point for all low-level operations on chat
Types
Builder to initialize the singleton ChatClient instance and configure its parameters.
Properties
Functions
Adds a list of error handlers.
Get the current settings of the app. Check AppSettings.
Returns a ChannelClient for given cid.
Returns a ChannelClient for given type and id.
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.
Initializes ChatClient for a specific user using the given user token. Check ChatClient.connectUser with TokenProvider parameter for advanced use cases.
Creates the channel. You can either create an id-based channel by passing not blank channelId or member-based (distinct) channel by leaving channelId empty. Use memberIds list to create a channel together with members. Make sure the list is not empty in case of creating member-based channel! Extra channel's information, for example name, can be passed in the extraData map.
Creates a newly available video call, which belongs to a channel. The video call will be created based on the third-party video integration (Agora and 100ms) on your Stream Dashboard.
Deletes the reaction associated with the message with the given message id. cid parameter is being used in side effect functions executed by plugins. You can skip it if plugins are not being used.
Disables slow mode for the channel.
Disconnect the current user, stop all observers and clear user data. This method should only be used whenever the user logout from the main app. If the user will continue using the Chat in the future, you shouldn't call this method.
Downloads the given file which can be fetched through the response body.
Enables slow mode for the channel. When slow mode is enabled, users can only send a message every cooldownTimeInSeconds time interval. The cooldownTimeInSeconds is specified in seconds, and should be between 1-MAX_COOLDOWN_TIME_SECONDS.
Returns application settings from the server or the default ones as a fallback.
Fetches a single message from the backend.
Returns a Call with messages that contain at least one desired type attachment but not necessarily all of them will have a specified type.
Returns a list of messages pinned in the channel. You can sort the list by specifying sort parameter. Keep in mind that for now we only support sorting by Message.pinnedAt. The list can be paginated in a few different ways using limit and pagination.
Returns all events that happened for a list of channels since last sync (while the user was not connected to the web-socket).
Returns all events that happened for a list of channels since last sync (while the user was not connected to the web socket). lastSyncAt is in yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z' format. Use this version of getSyncHistory when high precision is necessary.
Returns the currently available video call token.
Inherits the UserScope and provides its Job as an anchor for children.
Marks all the channel as read.
Mutes a channel for the current user. Messages added to the channel will not trigger push notifications, and will not change the unread count for the users that muted it. By default, mutes stay in place indefinitely until the user removes it. However, you can optionally set an expiration time. Triggers notification.channel_mutes_updated
event.
Mutes a user. Messages from muted users will not trigger push notifications. By default, mutes stay in place indefinitely until the user removes it. However, you can optionally set a mute timeout. Triggers notification.mutes_updated
event.
Pins the message.
Gets the channel from the server based on channelType, channelId and parameters from QueryChannelRequest. The call requires active socket connection if QueryChannelRequest.watch or QueryChannelRequest.presence is enabled, and will be automatically postponed and retried until the connection is established or the maximum number of attempts is reached.
Runs queryChannel without applying side effects.
Gets the channels from the server based on parameters from QueryChannelsRequest. The call requires active socket connection if QueryChannelsRequest.watch or QueryChannelsRequest.presence is enabled, and will be automatically postponed and retried until the connection is established or the maximum number of attempts is reached.
Gets the channels without running any side effects.
Query members and apply side effects if there are any.
Query users matching query request.
Search messages across channels. There are two ways to paginate through search results:
Uploads a file for the given channel. Progress can be accessed via callback.
Sends selected giphy message to the channel specified by Message.cid. The call will be retried accordingly to retryPolicy.
Uploads an image for the given channel. Progress can be accessed via callback.
Sends the message to the given channel. If isRetrying is set to true, the message may not be prepared again.
Sends the reaction. Use enforceUnique parameter to specify whether the reaction should replace other reactions added by the current user. cid parameter is being used in side effect functions executed by plugins. You can skip it if plugins are not being used.
Initializes ChatClient with stored user data. Caution: This method doesn't establish connection to the web socket, you should use connectUser instead.
Performs Giphy shuffle operation in the channel specified by Message.cid. Returns new "ephemeral" message with new giphy url. The call will be retried accordingly to retryPolicy.
Sends a EventType.TYPING_STOP event to the backend.
Stops watching the channel which means you won't receive more events for the channel. The call requires active socket connection and will be automatically postponed and retried until the connection is established.
Subscribes to the specific eventTypes of the client.
Subscribes to the specific eventTypes of the client, in the lifecycle of lifecycleOwner.
Subscribes for the next event with the given eventType.
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.
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.
Unmutes a channel for the current user. Triggers notification.channel_mutes_updated
event.
Unmutes a previously muted user. Triggers notification.mutes_updated
event.
Unpins the message that was previously pinned
Updates the message in the API and calls the plugins that handle this request. OfflinePlugin can be used here to store the updated message locally.
Extensions
Subscribes to client events of type T.
Subscribes to client events of type T, in the lifecycle of lifecycleOwner.
Subscribes to the specific eventTypes of the client.
Subscribes to the specific eventTypes of the client, in the lifecycle of lifecycleOwner.
Subscribes for the next client event of type T.