Skip to content

Commit b0e4a2d

Browse files
committed
Merge remote-tracking branch 'remotes/origin/develop' into develop.webrtc
Conflicts: bower.json js/modules/qbWebRTC.js js/qbConfig.js package.json quickblox.min.js
2 parents fcdb004 + a19ae14 commit b0e4a2d

File tree

2 files changed

+32
-113
lines changed

2 files changed

+32
-113
lines changed

README.md

Lines changed: 31 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,44 @@
1-
QuickBlox JavaScript SDK
2-
=================
1+
# QuickBlox JavaScript SDK
32

43
The QuickBlox JavaScript SDK provides a JavaScript library making it even
5-
easier to access the QuickBlox cloud backend platform.
4+
easier to access the QuickBlox cloud communication backend platform.
65

7-
For use inside browsers, a window scoped variable called `QB` is created.
6+
[QuickBlox](https://quickblox.com) is a suite of communication features & data services (APIs, SDKs, code samples, admin panel, tutorials) which help digital agencies, mobile developers and publishers to add great communication functionality to smartphone applications like in Skype, WhatsApp, Viber.
87

9-
Most functions, with the notable exception of init, take a callback
10-
parameter which gets called with an error and result parameter (ala node.js).
118

12-
If the call was sucessful then result will contain the reply from the
13-
QuickBlox platform. Similarly, if something went wrong then the error
14-
parameter will give you a description of what the problem was.
9+
# Install
1510

16-
Install
17-
----------------
18-
**Dependencies for browser**
11+
## Dependencies for browser
1912

20-
For correct work of JS SDK you must include the [jQuery](http://jquery.com/) library in your html before `quickblox.js`, like so:
13+
For the library to work, you need to include either [jQuery](http://jquery.com/) or [Zepto](http://zeptojs.com/) in your html before `quickblox.min.js`, like so:
14+
15+
For correct work of JS SDK you must include the library in your html before `quickblox.js`, like so:
2116

2217
```html
23-
<script src="jquery.min.js"></script>
24-
<script src="quickblox.js"></script>
18+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
19+
<script src="https://cdnjs.cloudflare.com/ajax/libs/quickblox/1.17.2/quickblox.min.js"></script>
2520
```
2621

27-
**Bower**
22+
## Bower and RequireJS
23+
24+
If you use bower package manager for your project, you can install JS SDK through bower:
2825

2926
```
3027
bower install quickblox --save
3128
```
3229

33-
**Node.js and NPM**
30+
When you use **RequireJS**, you are able to use quickblox as AMD module. SDK supports [UMD (Universal Module Definition)](https://github.com/umdjs/umd) pattern for JavaScript modules. So it is possible to use SDK everywhere (as browser global variable, with AMD module loader like RequireJS or as CommonJS module for Node.js environment).
31+
32+
## Node.js and NPM integration
33+
34+
Also you can use QuickBlox JavaScript SDK with server-side applications on NodeJS through the native node package. Just install the package in your application project like that:
3435

3536
```
3637
npm install quickblox --save
3738
```
3839

40+
And you're ready to go:
41+
3942
```javascript
4043
var QB = require('quickblox');
4144

@@ -45,113 +48,28 @@ var QB1 = new QuickBlox();
4548
var QB2 = new QuickBlox();
4649
```
4750

48-
A simple example
49-
----------------
50-
51-
```javascript
52-
// initalise the environmenet with my application id, authentication key and authentication secret
53-
QB.init(3477,'ChRnwEJ3WzxH9O4','AS546kpUQ2tfbvv');
54-
55-
// create an API session (user is not authenticated)
56-
QB.createSession(function(err, result) {
57-
if (err) {
58-
console.log('Something went wrong: ' + err);
59-
} else {
60-
console.log('Session created with id ' + result.id);
61-
}
62-
});
63-
64-
// list the users currently enrolled
65-
QB.users.listUsers(function(err, result) {
66-
for (var i=0; i < result.items.length; i++) {
67-
console.log('User ' + result.items[i].login + ' is registered');
68-
}
69-
});
70-
```
71-
72-
Alternative initialisation
73-
--------------------------
74-
75-
Based on user feedback it is now also possible to initialise the SDK using an existing token. This means you can generate a token elsewhere, for example serverside, and then use this token instead of initialising the SDK with your application key and secret.
76-
77-
The above simple example can then be coded as shown bellow:
78-
79-
```javascript
80-
// initialise using a pre-generated valid token
81-
QB.init('1b785b603a9ae88d9dfbd1fc0cca0335086927f1');
82-
83-
// list the users currently enrolled
84-
QB.users.listUsers(function(err, result) {
85-
for (var i=0; i < result.items.length; i++) {
86-
console.log('User ' + result.items[i].login + ' is registered');
87-
}
88-
});
89-
````
90-
91-
Passing configuration options
92-
----------------------
51+
## Download ZIP archive
9352

94-
Sometimes you will want to pass some configuration options such as a different enterprise endpoint, to enable/disable SSL, setting a timeout for your requests, or turn on debugging. You can do this by passing an `object` as a fourth parameter to `QB.init()`, like so:
53+
[QuickBlox JavaScript SDK, zip archive](https://github.com/QuickBlox/quickblox-javascript-sdk/archive/gh-pages.zip)
9554

96-
```javascript
97-
// Initialise with configuration options
98-
var config = {
99-
endpoints: {
100-
api: 'api.differenthost.com',
101-
chat: 'chat.differenthost.com',
102-
muc: 'muc.chat.differenthost.com'
103-
},
104-
chatProtocol: {
105-
bosh: 'https://chat.differenthost.com:5281'
106-
},
107-
debug: true,
108-
timeout: 5000,
109-
ssl: false
110-
};
111-
112-
QB.init(103, "89AO9Z2LobcegCG", "1Hs8XZpMxGRVPnD", config);
113-
114-
```
55+
# Browsers support
11556

116-
The code above would then make `QB` make API requests to `http://api.differenthost.com/` rather than `https://api.quickblox.com` and would give you full debugging to the console. It would also set a 5 second timeout for all your requests, triggering the `error` callback.
57+
| IE | Firefox | Chrome | Safari | Opera | Android Browser | Blackberry Browser | Opera Mobile | Chrome for Android | Firefox for Android |
58+
|:----:|:-------:|:------:|:------:|:-----:|:---------------:|:------------------:|:------------:|:------------------:|:------------------------:|
59+
| 10+ | 4+ | 13+ | 6+ | 12+ | 4.4+ | 10+ | 12+ | 35+ | 30+ |
11760

118-
Documentation
119-
----------------------
61+
# Documentation
12062

12163
You can look at it here http://quickblox.com/developers/Javascript
12264

123-
Questions and feedback
124-
----------------------
65+
# Questions and feedback
12566

12667
Please raise questions, requests for help etc. via http://stackoverflow.com/questions/tagged/quickblox
12768

12869
Feedback and suggestions for improvement always welcome :)
12970

71+
# Modifying and building the library
13072

131-
Creating sessions in more detail
132-
--------------------------------
133-
```
134-
QB.createSession(options, callback)
135-
136-
options: A map of additional options to pass to the method
137-
appId - your application's id (overrides the value passed to QB.init)
138-
authKey - your application's authorization key (overrides the value passed to QB.init)
139-
authSecret - your application's authorization secret (overrides the value passed to QB.init)
140-
login - the QuickBlox username of the person to login
141-
password - the QuickBlox user's password
142-
email - the email address of the QuickBlox user
143-
provider - the name of the social network provider for authenticating via Twitter of Facebook
144-
scope - a list of permisions required by the facebook app
145-
keys - a map of :
146-
token - social network access token
147-
secret - social network access token secret (only required for twitter)
148-
```
149-
150-
Please take a look at the specs for examples of how to use the APIs. In essence the JavaScript SDK is a thin facade to the REST API, so reading the docs [http://quickblox.com/developers/Overview] is strongly recommended :)
151-
152-
153-
Modifying and building the library
154-
----------------------------------
15573
The quickblox.js library is build from a number of **CommonJS modules** contained in the `js` folder. For example the `js/modules/qbUsers.js` module contains the code that deals with the [Users API](http://quickblox.com/developers/Users).
15674

15775
These modules are combined through [browserify](http://browserify.org/) into a single `quickblox.js` file in the root and so this is the only file that needs to be included in a `<script>` tag OR in a RequireJS application OR in Node.js environment (everywhere). To build the library, use the [Grunt](http://gruntjs.com/) task runner:
@@ -166,4 +84,5 @@ These modules are combined through [browserify](http://browserify.org/) into a s
16684
* `npm publish`. This action updates SDK for node package manager, but maybe you will be needed some author credentials for it (you should be in owner list)
16785
* Update QuickBlox developers section
16886

169-
87+
# License
88+
BSD

0 commit comments

Comments
 (0)