Learn how to add and configure QuickBlox SDK for your app.
Follow the instructions below to ensure that QuickBlox SDK runs smoothly with your app.
Visit Key Concepts page to learn the most important QuickBlox concepts.
QuickBlox application includes everything that brings messaging right into your application - chat, video calling, users, push notifications, etc. To create a QuickBlox application, follow the steps below:
The minimum requirements for QuickBlox React Native SDK are:
To connect QuickBlox to your app just add it into your project’s dependencies by running following code sample in terminal (in your react-native app):
iOS and Android have different dependencies systems. For that reason, you need to install dependencies in your iOS project. Navigate to ios/ folder in the root directory of the project and enter the following code snippet.
If your app requires adding some specific permissions to access camera, microphone, internet, and storage permissions, add these permissions to your app manifest.
Note that mentioning the camera and microphone permissions in the manifest isn’t always enough. You need to request camera and microphone permissions additionally at runtime.
You can use our SDK in the background mode as well. If you want to receive push notifications when the app goes to background mode, this requires you to add specific app permissions. Under the app build settings, open the Capabilities tab and turn on Remote notifications checkbox only.
If you want to use video calling functionality in the background mode, set the Audio, AirPlay, and Picture in Picture checkboxes.
You must initialize SDK before calling any methods through the SDK, except for the init()
method. If you attempt to call a method without initializing SDK previously - the error will be returned.
Initialize the framework with your application credentials. Specify Application ID, Authorization Key, Authorization Secret, and Account Key within appSettings
object and pass it to the init()
method.
Security
It’s not recommended to keep your authKey and authSecret inside an application in production mode, instead of this, the best approach will be to store them on your backend.
The init()
method accepts one argument of the object type that has the following fields:
Field | Required | Description |
---|---|---|
appId | yes | Application ID. |
authKey | yes | Authorization key. |
authSecret | yes | Authorization secret. |
accountKey | yes | Required to get actual apiEndpoint and chatEndpoint for the right server. |
You may don’t want to store authKey and authSecret inside an application for security reasons. In such case, you can initialize QuickBlox SDK with applicationId and accountKey only, and store your authKey and authSecret on your backend. But, if so, the implementation of authentication with QuickBlox should be also moved to your backend.
Then using your backend you can authorize a user in the QuickBlox system, send back the user session token, and set it to the QuickBlox SDK using startSessionWithToken()
method. You can find out more about this in the Set existing session section.
To point QuickBlox SDK to the QuickBlox enterprise server, you should set apiEndpoint
and chatEndpoint
fields of the appSettings
object and pass it to the init()
method.
The init()
method accepts one argument of the object type that has the following fields:
Field | Required | Description |
---|---|---|
appId | yes | Application ID. |
authKey | yes | Authorization key. |
authSecret | yes | Authorization secret. |
accountKey | yes | Required to get actual apiEndpoint and chatEndpoint for the right server. |
apiEndpoint | no | API endpoint. |
chatEndpoint | no | Chat endpoint. |
Contact our sales team to get API endpoint and chat endpoint.
QuickBlox Chat runs over XMPP protocol. To receive messages in a real-time mode, the application should be connected to the Chat over XMPP protocol. To enable auto-reconnect to Chat, call enableAutoReconnect()
method and pass enable
as true
.
Thus, if XMPP connection is lost and autoreconnect functionality is enabled, the app connects to Chat automatically. You can disable autoreconnection to Chat by passing enable
parameter as false
to enableAutoReconnect()
method.
By default, this parameter is enabled. Set autoreconnection before calling the login()
method so it could be applied in a current chat.
Logging functionality allows you to keep track of all events and activities while running your app. As a result, you can monitor the operation of the SDK and improve the debug efficiency. There are 3 logging use cases:
Message carbons functionality allows for multi-device support. Thus, all user messages get copied to all their devices so they could keep up with the current state of the conversation. For example, a User A has phone running conversations and desktop running conversations. User B has desktop running conversations. When User B sends a message to User A, the message shows on both the desktop and phone of User A.
Enable message carbons
Disable message carbons
By default, this parameter is turned off. Keep it enabled if you want to receive messages on all devices of the particular user (when a user is logged in on several devices).
Stream management has two important features Stanza Acknowledgements and Stream Resumption:
Call initStreamManagement()
method and pass autoReconnect
and messageTimeout
parameters to it to enable stream management.
The initStreamManagement()
method accepts one argument of the object type that has the following fields:
Field | Required | Description |
---|---|---|
autoReconnect | yes | Set it as true to use Stream resumption for new connections. Default: false. |
messageTimeout | yes | Preferred resumption time (in seconds). If this parameter is greater than 0, than it is applied, otherwise it is not applied. |
You should enable Stream Management before you do the login()
because the Stream Management is initialized while Chat login is performed.
The Stream Management defines an extension for active management of a stream between a client and server, including features for stanza acknowledgments.
Learn how to add and configure QuickBlox SDK for your app.
Follow the instructions below to ensure that QuickBlox SDK runs smoothly with your app.
Visit Key Concepts page to learn the most important QuickBlox concepts.
QuickBlox application includes everything that brings messaging right into your application - chat, video calling, users, push notifications, etc. To create a QuickBlox application, follow the steps below:
The minimum requirements for QuickBlox React Native SDK are:
To connect QuickBlox to your app just add it into your project’s dependencies by running following code sample in terminal (in your react-native app):
iOS and Android have different dependencies systems. For that reason, you need to install dependencies in your iOS project. Navigate to ios/ folder in the root directory of the project and enter the following code snippet.
If your app requires adding some specific permissions to access camera, microphone, internet, and storage permissions, add these permissions to your app manifest.
Note that mentioning the camera and microphone permissions in the manifest isn’t always enough. You need to request camera and microphone permissions additionally at runtime.
You can use our SDK in the background mode as well. If you want to receive push notifications when the app goes to background mode, this requires you to add specific app permissions. Under the app build settings, open the Capabilities tab and turn on Remote notifications checkbox only.
If you want to use video calling functionality in the background mode, set the Audio, AirPlay, and Picture in Picture checkboxes.
You must initialize SDK before calling any methods through the SDK, except for the init()
method. If you attempt to call a method without initializing SDK previously - the error will be returned.
Initialize the framework with your application credentials. Specify Application ID, Authorization Key, Authorization Secret, and Account Key within appSettings
object and pass it to the init()
method.
Security
It’s not recommended to keep your authKey and authSecret inside an application in production mode, instead of this, the best approach will be to store them on your backend.
The init()
method accepts one argument of the object type that has the following fields:
Field | Required | Description |
---|---|---|
appId | yes | Application ID. |
authKey | yes | Authorization key. |
authSecret | yes | Authorization secret. |
accountKey | yes | Required to get actual apiEndpoint and chatEndpoint for the right server. |
You may don’t want to store authKey and authSecret inside an application for security reasons. In such case, you can initialize QuickBlox SDK with applicationId and accountKey only, and store your authKey and authSecret on your backend. But, if so, the implementation of authentication with QuickBlox should be also moved to your backend.
Then using your backend you can authorize a user in the QuickBlox system, send back the user session token, and set it to the QuickBlox SDK using startSessionWithToken()
method. You can find out more about this in the Set existing session section.
To point QuickBlox SDK to the QuickBlox enterprise server, you should set apiEndpoint
and chatEndpoint
fields of the appSettings
object and pass it to the init()
method.
The init()
method accepts one argument of the object type that has the following fields:
Field | Required | Description |
---|---|---|
appId | yes | Application ID. |
authKey | yes | Authorization key. |
authSecret | yes | Authorization secret. |
accountKey | yes | Required to get actual apiEndpoint and chatEndpoint for the right server. |
apiEndpoint | no | API endpoint. |
chatEndpoint | no | Chat endpoint. |
Contact our sales team to get API endpoint and chat endpoint.
QuickBlox Chat runs over XMPP protocol. To receive messages in a real-time mode, the application should be connected to the Chat over XMPP protocol. To enable auto-reconnect to Chat, call enableAutoReconnect()
method and pass enable
as true
.
Thus, if XMPP connection is lost and autoreconnect functionality is enabled, the app connects to Chat automatically. You can disable autoreconnection to Chat by passing enable
parameter as false
to enableAutoReconnect()
method.
By default, this parameter is enabled. Set autoreconnection before calling the login()
method so it could be applied in a current chat.
Logging functionality allows you to keep track of all events and activities while running your app. As a result, you can monitor the operation of the SDK and improve the debug efficiency. There are 3 logging use cases:
Message carbons functionality allows for multi-device support. Thus, all user messages get copied to all their devices so they could keep up with the current state of the conversation. For example, a User A has phone running conversations and desktop running conversations. User B has desktop running conversations. When User B sends a message to User A, the message shows on both the desktop and phone of User A.
Enable message carbons
Disable message carbons
By default, this parameter is turned off. Keep it enabled if you want to receive messages on all devices of the particular user (when a user is logged in on several devices).
Stream management has two important features Stanza Acknowledgements and Stream Resumption:
Call initStreamManagement()
method and pass autoReconnect
and messageTimeout
parameters to it to enable stream management.
The initStreamManagement()
method accepts one argument of the object type that has the following fields:
Field | Required | Description |
---|---|---|
autoReconnect | yes | Set it as true to use Stream resumption for new connections. Default: false. |
messageTimeout | yes | Preferred resumption time (in seconds). If this parameter is greater than 0, than it is applied, otherwise it is not applied. |
You should enable Stream Management before you do the login()
because the Stream Management is initialized while Chat login is performed.
The Stream Management defines an extension for active management of a stream between a client and server, including features for stanza acknowledgments.