# Global

##

### Members

#### config

  Modules

#### config

  QuickBlox JavaScript SDK WebRTC Module (WebRTC helpers)

#### qbFetch

  For server-side applications through using npm package 'quickblox' you should include the following lines

### Methods

#### WebRTCSession(params)

modules/webrtc/qbWebRTCSession.js, line 70
  QuickBlox WebRTC session.

  Name | Type | Description
  --- | --- | ---
  `params` | Object |
  Name | Type | Description
  --- | --- | ---
  `callType` | 1 | 2 | Type of a call 1 - VIDEO 2 - AUDIO
  `opIDs` | Array.<number> | An array with opponents.
  `currentUserID` | number | Current user ID.
  `initiatorID` | number | Call initiator ID.
  `sessionID` | string | optional Session identifier (optional).
  `bandwidth` | number | optional Bandwidth limit.

#### WebRTCSignalingConstants()

modules/webrtc/qbWebRTCSignalingConstants.js, line 8
  QuickBlox JavaScript SDK WebRTC Module (WebRTC signaling constants)

#### _XMLtoJS(extension, title, element){Object}

modules/webrtc/qbWebRTCSignalingProcessor.js, line 137

  Name | Type | Description
  --- | --- | ---
  `extension` | Object |
  `title` | string |
  `element` | Element |

  ##### Returns:

  Type | Description
  --- | ---
  Object |

#### _getExtension(extraParams){Object}

modules/webrtc/qbWebRTCSignalingProcessor.js, line 73
  Convert XML into JS object

  Name | Type | Description
  --- | --- | ---
  `extraParams` | Element |

  ##### Returns:

  Type | Description
  --- | ---
  Object |

#### _getStats()

modules/webrtc/qbRTCPeerConnection.js, line 505
  PRIVATE

#### _prepareExtension()

modules/webrtc/qbWebRTCSession.js, line 1271
  private _prepareExtension - replace property null to empty string return object with property or empty if extension didn't set

#### _removeExtmapMixedFromSDP(description)

modules/webrtc/qbRTCPeerConnection.js, line 740
  This is to fix error on legacy WebRTC implementations

  Name | Type | Description
  --- | --- | ---
  `description` | RTCSessionDescriptionInit |

#### getCodecPayloadTypeFromLine(sdpLine){string|null}

modules/webrtc/qbRTCPeerConnection.js, line 664
  Gets the codec payload type from an a=rtpmap:X line.

  Name | Type | Description
  --- | --- | ---
  `sdpLine` | string |

  ##### Returns:

  Type | Description
  --- | ---
  string | null |

#### isOpponentsEqual()

modules/webrtc/qbWebRTCClient.js, line 379
  PRIVATE FUNCTIONS

#### setDefaultCodec(mLine, payload){string}

modules/webrtc/qbRTCPeerConnection.js, line 676
  Returns a new m= line with the specified codec as the first one.

  Name | Type | Description
  --- | --- | ---
  `mLine` | string |
  `payload` | string |

  ##### Returns:

  Type | Description
  --- | ---
  string |

#### setMediaBitrate(sdp, media, bitrate){string}

modules/webrtc/qbRTCPeerConnection.js, line 760

  Name | Type | Description
  --- | --- | ---
  `sdp` | string |
  `media` | 'audio' | 'video' |
  `bitrate` | number | optional

  ##### Returns:

  Type | Description
  --- | ---
  string |

#### setPreferredCodec(sdp, type, codec){string}

modules/webrtc/qbRTCPeerConnection.js, line 699
  Mangles SDP to put preferred codec at the beginning

  Name | Type | Description
  --- | --- | ---
  `sdp` | string |
  `type` | 'audio' | 'video' |
  `codec` | string | VP9, VP8, H264, opus etc.

  ##### Returns:

  Type | Description
  --- | ---
  string |

### Type Definitions

#### MediaParamsObject

  ##### Properties:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `params.audio` | boolean | MediaTrackConstraints | <optional> |
  `params.video` | boolean | MediaTrackConstraints | <optional> |
  `params.elemId` | string | <optional> | Id of HTMLVideoElement.
  `params.options` | Object | <optional> | ###### Properties
  Name | Type | Argument | Description
  --- | --- | --- | ---
  `muted` | boolean | <optional> |
  `mirror` | boolean | <optional> |

#### addRosterCallback()

modules/chat/qbChat.js, line 1694
  Callback for QB.chat.roster.add(). Run without parameters.

#### chatConnectCallback(error, response)

modules/chat/qbChat.js, line 708
  This callback Returns error or contact list.

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.
  `response` | Object | Boolean | Object of subscribed users (roster) or empty body.

#### confirmRosterCallback()

modules/chat/qbChat.js, line 1725
  Callback for QB.chat.roster.confirm(). Run without parameters.

#### createAndUploadFileCallback(error, response)

modules/qbContent.js, line 123
  Callback for QB.content.createAndUpload(params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | The file object (blob-object-access).

#### createDataCallback(error, response)

modules/qbData.js, line 45
  Callback for QB.data.create(className, data, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | An object.

#### createDialogCallback(error, createdDialog)

modules/chat/qbDialog.js, line 48
  Callback for QB.chat.dialog.create().

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.
  `createdDialog` | Object | the dialog object.

#### createFileCallback(error, response)

modules/qbContent.js, line 70
  Callback for QB.content.create(params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | The file object (blob-object-access).

#### createMessageCallback(error, messages)

modules/chat/qbMessage.js, line 43
  Callback for QB.chat.message.create().

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.
  `messages` | Object | The message object.

#### createPrivacylistCallback(error)

modules/chat/qbChat.js, line 2091
  Callback for QB.chat.privacylist.create().

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.

#### createPushEventCallback(error, response)

modules/qbPushNotifications.js, line 146
  Callback for QB.pushnotifications.events.create(params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | An event object.

#### createPushSubscriptionCallback(error, response)

modules/qbPushNotifications.js, line 56
  Callback for QB.pushnotifications.subscriptions.create(params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | Array of all existent user's subscriptions.

#### createSession(error, session)

qbMain.js, line 212
  This callback return session object.

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.
  `session` | Object | Contains of session object.

#### createUserCallback(error, response)

modules/qbUsers.js, line 179
  Callback for QB.users.create(params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | The user object.

#### deleteDialogCallback(error)

modules/chat/qbDialog.js, line 98
  Callback for QB.chat.dialog.delete().

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.

#### deleteFileCallback(error, response)

modules/qbContent.js, line 96
  Callback for QB.content.delete(id, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | Boolean.

#### deleteFileFromDataCallback(error, response)

modules/qbData.js, line 362
  Callback for QB.data.deleteFile(className, params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | Empty body.

#### deleteMessageCallback(error, res)

modules/chat/qbMessage.js, line 93
  Callback for QB.chat.message.delete().

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.
  `res` | String | Empty string.

#### deletePrivacylistCallback(error)

modules/chat/qbChat.js, line 2463
  Callback for QB.chat.privacylist.delete().

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.

#### deletePushEventByIdCallback(error, response)

modules/qbPushNotifications.js, line 209
  Callback for QB.pushnotifications.events.delete(id, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | Empty body.

#### deletePushSubscriptionCallback(error, response)

modules/qbPushNotifications.js, line 87
  Callback for QB.pushnotifications.subscriptions.delete(id, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | Empty body.

#### deleteUserCallback(error, response)

modules/qbUsers.js, line 254
  Callback for QB.users.delete(params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | Empty body.

#### deletedDataCallback(error, response)

modules/qbData.js, line 207
  Callback for QB.data.delete(className, requestedData, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | null |
  Name | Type | Description
  --- | --- | ---
  `deleted` | array | Array of ids of deleted records. If you delete BY CRITERIA this property will be null.
  `deletedCount` | number | Count of deleted records.

#### destroySessionCallback(error, result)

qbMain.js, line 227
  This callback returns error or empty string.

  Name | Type | Description
  --- | --- | ---
  `error` | Object | Null | The error object if got en error and null if success.
  `result` | Null | String | String (" ") if session was removed successfully.

#### downloadFileByUIDCallback(error, response)

modules/qbContent.js, line 293
  Callback for QB.content.getFile(uid, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | The file object.

#### downloadFileFromDataCallback(error, response)

modules/qbData.js, line 327
  Callback for QB.data.downloadFile(className, params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | The file object.

#### getFileInfoByIdCallback(error, response)

modules/qbContent.js, line 271
  Callback for QB.content.getInfo(id, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | The file object (blob-object-access).

#### getListPrivacylistCallback(error, response)

modules/chat/qbChat.js, line 2247
  Callback for QB.chat.privacylist.getList().

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.
  `response` | Object | The privacy list object.

#### getNamesPrivacylistCallback(error, response)

modules/chat/qbChat.js, line 2369
  Callback for QB.chat.privacylist.getNames().

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.
  `response` | Object | The privacy list object (var names = response.names;).

#### getPushEventByIdCallback(error, response)

modules/qbPushNotifications.js, line 193
  Callback for QB.pushnotifications.events.get(id, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | An array of events' objects.

#### getPushEventStatusByIdCallback(error, response)

modules/qbPushNotifications.js, line 225
  Callback for QB.pushnotifications.events.status(id, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | An array of events' objects.

#### getRosterCallback(roster)

modules/chat/qbChat.js, line 1633
  This callback Return contact list.

  Name | Type | Description
  --- | --- | ---
  `roster` | Object | Object of subscribed users.

#### getSessionCallback(error, session)

qbMain.js, line 162
  This callback return session object..

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.
  `session` | Object | Contains of session object.

#### getUsersCallback(error, response)

modules/qbUsers.js, line 118
  Callback for QB.users.get(params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | The user object or object with Array of users.

#### joinMacCallback(error, responce)

modules/chat/qbChat.js, line 1880
  Callback for QB.chat.muc.join().

  Name | Type | Description
  --- | --- | ---
  `error` | Object | Returns error object or null.
  `responce` | Object | Returns responce.

#### leaveMacCallback()

modules/chat/qbChat.js, line 1965
  Callback for QB.chat.muc.leave(). run without parameters;

#### listDialogCallback(error, resDialogs)

modules/chat/qbDialog.js, line 23
  Callback for QB.chat.dialog.list().

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.
  `resDialogs` | Object | the dialog list.

#### listMessageCallback(error, messages)

modules/chat/qbMessage.js, line 23
  Callback for QB.chat.message.list().

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.
  `messages` | Object | The messages object.

#### listOfDataCallback(error, response)

modules/qbData.js, line 101
  Callback for QB.data.list(className, filters, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | Object with Array of files.

#### listOfFilesCallback(error, response)

modules/qbContent.js, line 39
  Callback for QB.content.list(params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | Object with Array of files.

#### listOnlineUsersMacCallback(Users)

modules/chat/qbChat.js, line 2008
  Callback for QB.chat.muc.leave().

  Name | Type | Description
  --- | --- | ---
  `Users` | Object | List of online users.

#### listPushEventsCallback(error, response)

modules/qbPushNotifications.js, line 172
  Callback for QB.pushnotifications.events.list(params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | An array of events' objects.

#### listPushSubscriptionCallback(error, response)

modules/qbPushNotifications.js, line 71
  Callback for QB.pushnotifications.subscriptions.list(callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | Array of all existent user's subscriptions.

#### listUsersCallback(error, response)

modules/qbUsers.js, line 38
  Callback for QB.users.listUsers(params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | Object with Array of users.

#### loginCallback(error, result)

qbMain.js, line 243
  This callback return error or user Object.

  Name | Type | Description
  --- | --- | ---
  `error` | Object | Null | The error object if got en error and null if success.
  `result` | Null | Object | User data object if everything goes well and null on error.

#### logoutCallback(error, result)

qbMain.js, line 258
  This callback return error or user Object.

  Name | Type | Description
  --- | --- | ---
  `error` | Object | Null | The error object if got en error and null if success.
  `result` | Null | String | String (" ") if session was removed successfully.

#### markUploadedFileCallback(error, response)

modules/qbContent.js, line 242
  Callback for QB.content.markUploaded(params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | The empty body.

#### rejectRosterCallback()

modules/chat/qbChat.js, line 1762
  Callback for QB.chat.roster.reject(). Run without parameters.

#### removeRosterCallback()

modules/chat/qbChat.js, line 1794
  Callback for QB.chat.roster.remove(). Run without parameters.

#### resetPasswordByEmailCallback(error, response)

modules/qbUsers.js, line 280
  Callback for QB.users.resetPassword(email, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | Empty body.

#### setAsDefaultPrivacylistCallback(error)

modules/chat/qbChat.js, line 2523
  Callback for QB.chat.privacylist.setAsDefault().

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.

#### unreadCountMessageCallback(error, res)

modules/chat/qbMessage.js, line 122
  Callback for QB.chat.message.unreadCount().

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.
  `res` | Object | The requested dialogs Object.

#### updateDataCallback(error, response)

modules/qbData.js, line 144
  Callback for QB.data.update(className, data, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | An object.

#### updateDialogCallback(error, res)

modules/chat/qbDialog.js, line 74
  Callback for QB.chat.dialog.update()

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.
  `res` | Object | the dialog object.

#### updateFileCallback(error, response)

modules/qbContent.js, line 317
  Callback for QB.content.update(uid, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | The file object (blob-object-access).

#### updateMessageCallback(error, response)

modules/chat/qbMessage.js, line 68
  Callback for QB.chat.message.update().

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.
  `response` | Object | Empty body.

#### updatePrivacylistCallback(error, response)

modules/chat/qbChat.js, line 2334
  Callback for QB.chat.privacylist.update().

  Name | Type | Description
  --- | --- | ---
  `error` | Object | The error object.
  `response` | Object | The privacy list object.

#### updateUserCallback(error, response)

modules/qbUsers.js, line 216
  Callback for QB.users.update(id, params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | The user object.

#### uploadFileCallback(error, response)

modules/qbContent.js, line 209
  Callback for QB.content.upload(params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | The empty object.

#### uploadFileToDataCallback(error, response)

modules/qbData.js, line 288
  Callback for QB.data.uploadFile(className, params, callback).

  Name | Type | Description
  --- | --- | ---
  `error` | object | The error object.
  `response` | object | The file object.