![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
quickblox-react-native-sdk
Advanced tools
See docs at https://docs.quickblox.com/docs/react-native-quick-start
This guide demonstarates how to connect quickblox-react-native-sdk to your project and start development.
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:
To connect QuickBlox to your app just add it into your dependencies in package.json
- to do so, in the root directory of the project execute the following command in terminal:
npm install quickblox-react-native-sdk --save
iOS and Android have different dependencies systems. For that reason, you need to install dependencies in your iOS project. Just locate ios/ folder in the root directory of the project and enter the following command in terminal:
pod install
Initialize the framework with your application credentials. Pass appId
, authKey
, authSecret
, accountKey
to the QB.settings.init
method using the code snippet below. As a result, your application details are stored in the server database and can be subsequently identified on the server.
const appSettings = {
appId: '',
authKey: '',
authSecret: '',
accountKey: '',
apiEndpoint: '', // optional
chatEndpoint: '' // optional
};
QB.settings
.init(appSettings)
.then(function () {
// SDK initialized successfully
})
.catch(function (e) {
// Some error occured, look at the exception message for more details
});
In order to use the abilities of QuickBlox SDK, you need to authorize your app on the server, log in to your account and create a session. To get it all done call QB.auth.login
method and pass login
and password
parameters to it using the code snippet below.
QB.auth
.login({
login: 'yourlogin',
password: 'yourpassword'
})
.then(function (info) {
// signed in successfully, handle info as necessary
// info.user - user information
// info.session - current session
})
.catch(function (e) {
// handle error
});
Note! You must initialize SDK before calling any methods through the SDK except for the method initializing your QuickBlox instance. If you attempt to call a method without connecting, the error is returned.
To connect to chat server, use the code snippet below:
QB.chat
.connect({
userId: 12345,
password: 'passw0rd!'
})
.then(function () {
// connected successfully
})
.catch(function (e) {
// some error occurred
});
QuickBlox provides three types of dialogs: 1-1 dialog, group dialog, and public dialog. Learn more about dialogs here.
Let’s create 1-1 dialog. Call QB.chat.createDialog
method and pass QB.chat.DIALOG_TYPE.CHAT
parameter as a dialog type to it. QB.chat.DIALOG_TYPE.CHAT
parameter allows specifying that two occupants are going to participate in the dialog.
QB.chat
.createDialog({
type: QB.chat.DIALOG_TYPE.CHAT,
occupantsIds: [12345]
})
.then(function (dialog) {
// handle as necessary
})
.catch(function (e) {
// handle error
});
To receive new messages, assign event handler using the code snippet below:
import { NativeEventEmitter } from 'react-native'
const emitter = new NativeEventEmitter(QB.chat)
emitter.addListener(QB.chat.EVENT_TYPE.MESSAGE.RECEIVED_NEW_MESSAGE, event => {
const { type, payload } = event
// type - type of the event (string)
// payload - new message (object)
})
When a dialog is created, a user can send a message. To create and send your first message, call QB.chat.sendMessage
method and specify the dialogId
and body
parameters to it. Pass saveToHistory
parameter if you want this message to be saved in chat history that is stored forever.
const message = {
dialogId: 'dsfsd934329hjhkda98793j2',
body: 'Hey there!',
saveToHistory: true
};
QB.chat
.sendMessage(message)
.then(function () { /* send successfully */ })
.catch(function (e) { /* handle error */ })
For license information, please visit: https://quickblox.com/terms-of-use/
FAQs
QuickBlox SDK for React Native
The npm package quickblox-react-native-sdk receives a total of 267 weekly downloads. As such, quickblox-react-native-sdk popularity was classified as not popular.
We found that quickblox-react-native-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.