Set/Update User Profile Data
Register#
To register a new user use the below method. You will get the username and password in the response. By providing that username and password to the connect method you can connect in to the server further.
note
During the initialization, if the isTrialLicenseKey is set to true in the initialization, users will be registered in the trial mode.
Request Params#
| Status | Description | Type | Required |
|---|---|---|---|
USER_IDENTIFIER | Unique Id to Register the User. User identifier can only contain lowercase alphanumeric characters, hyphens (-), and underscores (_) | String | true |
FORCE_REGISTER | default value true provide true to force the old session logged out when the registered user has reached the maximum number of multiple-sessions or provide false to allow registration till the maximum no of multiple-sessions reached | Boolean | false |
registerMetaData | registerMetaData is an optional parameter to provide MetaData of user. Maximum size is 3 | Object | false |
Request Input for registerMetaData#
| Arguments | Description | Type |
|---|---|---|
| key | Name of the Key | String |
| value | Name of the value | String or Boolean or Number |
caution
If FORCE_REGISTER is false and if it reached the maximum no of multiple-sessions, then registration will not success and it will throw a 405 exception. Either FORCE_REGISTER should be true or one of the existing session need to be logged out to continue registration.
Response Params#
| Arguments | Description | Type |
|---|---|---|
| statusCode | Status Code | Number |
| message | Success/Error Message | String |
| data | Username, Password, isProfileUpdated, isSandbox, userJid | Object |
Sample Response:#
Connect with Username#
Make a connection to the server by using the credentials got as a response of the register method. Once the connection is made successfully, it returns a Promise with statusCode of 200, else throws an Error.
This will also emit the connection status. It will be received in connectionListener callback function. If any error occurs while making a connection with the server, You will receive the error in the callback.
Request Params#
| Status | Description | Type | Required |
|---|---|---|---|
USERNAME | Username | String | true |
PASSWORD | Password | String | true |
Response Params#
| Arguments | Description | Type |
|---|---|---|
| statusCode | Status Code | Number |
| message | Success/Error Message | String |
Sample Response:#
Login with QR Code#
If Login needs to be done via QR Code scan from Mobile, generate new QR Code with below method.
Once the QR Code scanned successfully, the user will be with XMPP, and username and password will be received in callback response
Request Params#
| Status | Description | Type | Required |
|---|---|---|---|
DOM_ELEMENT_ID | Canvas element id in which QR Code has to appended | String | true |
LOGO_ELEMENT_ID | Branding Logo in the QR Code | String | true |
SIGNAL_SERVER_URL | Signal Server URL for Socket Connection | String | true |
Example Request#
note
If you log out from the mobile device, a callback listener will be triggered, Check here for more details.
Update User Profile Detail#
To set the Profile detail of the user, send a request as described below.
Once the request is successfully made, a callback userProfileListener will be triggered for the current user and also for the friends (Contacts of the current user) to get the latest profile details.
Request Params#
| Status | Description | Type | Required |
|---|---|---|---|
NAME | Nickname of the User | String | true |
IMAGE | Profile Image - Upload an image file or image URL | File / String | true |
STATUS | Profile Status | String | true |
MOBILE_NUMBER | Mobile Number | String | true |
EMAIL | Email Address | String | true |
Example Request#
Image as a URL
Image as a FILE
Set User Token#
To set the user token locally.
Request Params#
| Status | Description | Type | Required |
|---|---|---|---|
TOKEN | User Token | String | true |
Response Params#
| Arguments | Description | Type |
|---|---|---|
| statusCode | Status Code | Number |
| message | Success/Error Message | String |