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
Get the current settings of the app. Check AppSettings.
Block a user by ID.
Cast a vote for a poll in a message.
Returns a ChannelClient for given cid.
Returns a ChannelClient for given type and id.
Clear local data stored on the device from the current user.
Close a poll in a message.
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 file represented by url from the given channel.
Deletes the image represented by url from the given channel.
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 logouts from the main app. You shouldn't call this method, if the user will continue using the Chat in the future.
Dismiss notifications from a given channelType and channelId. Be sure to initialize ChatClient before calling 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.
Enriches the given URL with Open Graph data.
Fetches the current user. Works only if the user was previously set and the WS connections is closed.
Returns application settings from the server or the default ones as a fallback.
Gets the channel from the server based on cid.
Gets the channel from the server based on channelType and channelId.
Fetches a single message from the backend.
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.
Get a thread by message id.
Returns the currently available video call token.
Hides the specified channel with side effects.
Inherits the UserScope and provides its Job as an anchor for children.
Marks all the channel as read.
Marks a given thread as read.
Marks the specified channel as unread.
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.
Return na list of blocked users.
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.
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 threads matching query request.
Query threads matching query request.
Query users matching query request.
Reconnects the socket. Works only if the user was previously set and the WS connections is closed.
Remove a vote for a poll in a message.
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.
Send a message with a poll to the given channel.
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.
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.
Removes all of the messages of the channel but doesn't affect the channel data or members.
Unblock a user by ID.
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.
Inherited functions
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.