Integrate React Native Audio Call SDK for App in 30 Mins
#
Quick Start#
Call SDKs for React NativeWith CONTUS MirrorFly Call SDK for react native app, you can easily add real-time calls features to your client app within 30 minutes.
note
If you're looking for the fastest way to build your app’s UI with MirrorFly Call SDK, you can use our sample apps. To get our sample apps, click here
#
RequirementsWith MirrorFly React Native, make sure that you install all the below mentioned peer dependencies with their specific versions.
Node
- 14.20.0npm
- 6.14.10react-native
>= 0.69.12
#
Getting Started#
Things To Be Noted Before You Get Started#
SDK License Keycaution
Skip this part if you are already having your license key.
To integrate MirrorFly Call SDK into your app, you will need a SDK License Key. The MirrorFly server will use this license key to authenticate the SDK in your application.
#
To get the License Key,Step 1: Register here to get a MirrorFly User account. Registration is subject to verification and would take up to 24 hours.
Step 2: Login to your Account
Step 3: Get the License key from the application Info
’ section
#
Integrate Call SDK into Your React Native AppCONTUS MirrorFly Call for React Natvive, makes the in-app call development process easy with all the essential messaging features
#
Integrate Using Npm packagenote
Install mirrorfly-reactnative-sdk (https://www.npmjs.com/package/mirrorfly-reactnative-sdk) npm package by using the below command
Step 1: Install Mirrorfly Sdk in your application
Step 2: Import the SDK into your application where you want
#
TerminologyThe below are the common keywords/terminologies used in SDKs with their descriptions
Keyword | Description |
---|---|
userId | Unique ID assigned for each user Ex: 12345678 (any alphanumeric). The below characters is not allowed in userId: U+0022 (") U+0026 (&) U+0027 (') U+002F (/) U+003A (:) U+003C (<) U+003E (>) U+0040 (@) userID should follow below specification: https://xmpp.org/extensions/xep-0106.html |
userJid | userID+@+domain of the chat server Ex. 12345678@xmpp.chatsystem.dev.contus.us |
groupJid | Unique ID assigned for each group Ex: group123456 (any alphanumeric). GroupJID = groupID +@mix.+domain of the chat server Ex: group123456@mix.xmpp.mirrorfly.dev.contus.us` |
#
Adding NPM package dependencies to integrate the calls SDKAdd the chat related dependencies as mentioned here. And then add the calls dependencies as given below.
#
Initialize calls SDKTo begin with the initialization process of the calls SDK you are required to have certain data that responds to the changes in the connection status in the client's app.
Now, paste the license key on the licensekey param and use the below given method to pass these data through the SDK for further processing.
note
You can find the sandbox server details in the further Sandbox section for testing purposes.
#
Request ParamsArguments | Description | Type | Required |
---|---|---|---|
apiBaseUrl | API Base URL for Backend | String | true |
licenseKey | Mirrorfly's License Key | String | true |
isTrialLicenseKey | if true Trial Mode will be Enabled | Boolean | false |
callbackListeners | Check here for callback listerners | Object | true |
#
Response ParamsArguments | Description | Type |
---|---|---|
statusCode | Status Code | Number |
message | Success/Error Message | String |
#
Sandbox DetailsThe apiUrl
and licenseKey
details can get it from the 'Overview' section in the mirrorfly Console dashboard.
note
To learn more about callback listeners, go to the Callback Event Listener Section.
#
Example Response#
Create a Usercaution
Skip this part if you are already integrated the register and connect method.
#
Register UserStep 1: You can use the below given method to register a new user.
Step 2: Once you are registered, you will be provided with a username and password that you can utilize to make the connection with the server via connect method.
#
Request ParamsStatus | Description | Type | Required |
---|---|---|---|
USER_IDENTIFIER | Unique Id to Register the User | String | true |
ANDROID_FCM_TOKEN | FCM token for android device | String | true |
IOS_VOIP_TOKEN | VOIP token for iOS device | String | true |
IS_PRODUCTION | Whether or not the app is running in production environment | Boolean | true |
note
IS_PRODUCTION
param should be passed true when the app is running in release mode and should be passed false if it is in debug mode.
#
Sample code for register user#
Response ParamsArguments | Description | Type |
---|---|---|
statusCode | Status Code | Number |
message | Success/Error Message | String |
data | Username and Password | Object |
#
Sample Response:caution
username
is the unique id that allows you to connect with other users to send or receive messages.
#
Connect to MirrorFly ServerStep 1: You can use the credentials that you have obtained while registration to make the connection with the server.
Step 2: Once you have created the connection successfully, you will be responded with an approval message as ‘statusCode of 200’ or else will get an execution error.
Step 3: With this you can also trace the connection status that you receive in connectionListener callback function.
Step 4: If you face any error while making a connection with the server, you will receive an error message with callback.
#
Request ParamsStatus | Description | Type | Required |
---|---|---|---|
USERNAME | Username | String | true |
PASSWORD | Password | String | true |
#
Response ParamsArguments | Description | Type |
---|---|---|
statusCode | Status Code | Number |
message | Success/Error Message | String |
#
Sample Response:note
To learn more about all possible logins and profile related setup, go to Profile Section.