Before you begin
- Register a QuickBlox account. This is a matter of a few minutes and you will be able to use this account to build your apps.
- Configure QuickBlox SDK for your app. Check out Setup page for more details.
- Create a user session to be able to use QuickBlox functionality. See Authentication page to learn how to do it.
Connect to Chat server
To connect to Chat server use the code snippet below.Dart
Subscribe to connection state
Subscribe to the connection state changes using the following code snippet.Dart
Check if connected to Chat server
Check the connection state using the following code snippet.Dart
Disconnect from Chat server
Disconnect from the Chat server using the snippet below.Dart
Enable auto-reconnect to Chat
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.Dart
Manage Chat connections
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 thedisconnect()
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.
Dart
Argument | Required | Description |
---|---|---|
userId | yes | The ID of a user. |
userPassword | yes | The password of the user. |