Learn how to connect to the chat server and set connection settings.
Visit Key Concepts page to learn the most important QuickBlox concepts.
To connect to Chat server use the code snippet below.
Subscribe to the connection state changes using the following code snippet.
Check the connection state using the following code snippet.
Disconnect from the Chat server using the snippet below.
The SDK reconnects automatically when the connection to the Chat server is lost. There is a way to disable it and then manage it manually.
To provide a seamless chat experience, our SDK manages connections to the Chat server at an application-wide level. Thus, to handle offline messages correctly, use the disconnect()
method when an app goes to the background and the connect()
method when an app goes to the foreground. As a result, the SDK will disconnect/connect the current user from the Chat server when the app goes to the background/foreground mode.
Argument | Required | Description |
---|---|---|
userId | yes | The ID of a user. |
userPassword | yes | The password of the user. |
Learn how to connect to the chat server and set connection settings.
Visit Key Concepts page to learn the most important QuickBlox concepts.
To connect to Chat server use the code snippet below.
Subscribe to the connection state changes using the following code snippet.
Check the connection state using the following code snippet.
Disconnect from the Chat server using the snippet below.
The SDK reconnects automatically when the connection to the Chat server is lost. There is a way to disable it and then manage it manually.
To provide a seamless chat experience, our SDK manages connections to the Chat server at an application-wide level. Thus, to handle offline messages correctly, use the disconnect()
method when an app goes to the background and the connect()
method when an app goes to the foreground. As a result, the SDK will disconnect/connect the current user from the Chat server when the app goes to the background/foreground mode.
Argument | Required | Description |
---|---|---|
userId | yes | The ID of a user. |
userPassword | yes | The password of the user. |