# ChatsRx

class ChatsRx

## Types

Companion
Link copied to clipboard
object Companion

## Properties

currentChats
Link copied to clipboard
val currentChats: List<Chat>

Contains the list of all chat instances associated with the current user.

currentGroupChats
Link copied to clipboard
val currentGroupChats: List<Chat>

Contains the list of group chat instances associated with the current user.

currentIndividualChats
Link copied to clipboard
val currentIndividualChats: List<Chat>

Contains the list of individual chat instances associated with the current user.

groupChatAdded
Link copied to clipboard
val groupChatAdded: Observable<Chat>

Emits when a group Chat is created.

groupChatRemoved
Link copied to clipboard
val groupChatRemoved: Observable<Chat>

Emits when a group Chat is removed.

groupChatUpdated
Link copied to clipboard
val groupChatUpdated: Observable<Chat>

Emits when a group Chat is updated.

individualChatAdded
Link copied to clipboard
val individualChatAdded: Observable<Chat>

Emits when a individual Chat is created.

individualChatRemoved
Link copied to clipboard
val individualChatRemoved: Observable<Chat>

Emits when a individual Chat is removed.

individualChatUpdated
Link copied to clipboard
val individualChatUpdated: Observable<Chat>

Emits when an individual Chat is updated.

state
Link copied to clipboard
val state: Observable<XmppClient.State>

Emits the XMPP session state whenever it changes. When a subscriber is added, it will also emit the current value.

## Functions

connect
Link copied to clipboard
fun connect(isDebugEnabled: Boolean = false): Completable

Connects a chat session.

createChat
Link copied to clipboard
fun createChat(creationType: CreationType): Single<Chat>

Creates a new chat.

disablePushNotifications
Link copied to clipboard
fun disablePushNotifications(): Completable

Disables the Push Notifications for incoming messages. Disables notifications against XMPP server.

disconnect
Link copied to clipboard
fun disconnect(): Completable

Disconnects a chat session and disables the chat push notifications. This should be called on logout.

enablePushNotifications
Link copied to clipboard
fun enablePushNotifications(): Completable

Enables the Push Notifications for incoming messages. Enable notifications against XMPP server. It must be called after setPushToken or to have the dnd option disabled in order for it to work.

getAllChats
Link copied to clipboard
fun getAllChats(): Single<List<Chat>>

Fetches both individual and group chats related to this user.

getGroupChats
Link copied to clipboard
fun getGroupChats(): Single<List<Chat>>

Fetches all group chats related to this user.

getIndividualChats
Link copied to clipboard
fun getIndividualChats(): Single<List<Chat>>

Fetches all individual chats related to this user.

joinGroupChats
Link copied to clipboard
fun joinGroupChats(): Completable

Joins all the group chats in the list of currentGroupChats.

restore
Link copied to clipboard
fun restore(isDebugEnabled: Boolean = false): Completable

Restores the active xmpp session..

suspend
Link copied to clipboard
fun suspend(): Completable

Suspends a chat session. This should be called when the app enters background in order to receive chat push notifications.