Skip to content

Commit eea0e5b

Browse files
author
Igor Khomenko
committed
Update README.md
1 parent 00e669c commit eea0e5b

File tree

1 file changed

+7
-97
lines changed

1 file changed

+7
-97
lines changed

README.md

Lines changed: 7 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -48,113 +48,22 @@ var QB1 = new QuickBlox();
4848
var QB2 = new QuickBlox();
4949
```
5050

51-
A simple example
52-
----------------
51+
## Download ZIP archive
5352

54-
```javascript
55-
// initalise the environmenet with my application id, authentication key and authentication secret
56-
QB.init(3477,'ChRnwEJ3WzxH9O4','AS546kpUQ2tfbvv');
57-
58-
// create an API session (user is not authenticated)
59-
QB.createSession(function(err, result) {
60-
if (err) {
61-
console.log('Something went wrong: ' + err);
62-
} else {
63-
console.log('Session created with id ' + result.id);
64-
}
65-
});
66-
67-
// list the users currently enrolled
68-
QB.users.listUsers(function(err, result) {
69-
for (var i=0; i < result.items.length; i++) {
70-
console.log('User ' + result.items[i].login + ' is registered');
71-
}
72-
});
73-
```
74-
75-
Alternative initialisation
76-
--------------------------
53+
[QuickBlox JavaScript SDK, zip archive](https://github.com/QuickBlox/quickblox-javascript-sdk/archive/gh-pages.zip)
7754

78-
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.
79-
80-
The above simple example can then be coded as shown bellow:
81-
82-
```javascript
83-
// initialise using a pre-generated valid token
84-
QB.init('1b785b603a9ae88d9dfbd1fc0cca0335086927f1');
85-
86-
// list the users currently enrolled
87-
QB.users.listUsers(function(err, result) {
88-
for (var i=0; i < result.items.length; i++) {
89-
console.log('User ' + result.items[i].login + ' is registered');
90-
}
91-
});
92-
````
93-
94-
Passing configuration options
95-
----------------------
96-
97-
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:
98-
99-
```javascript
100-
// Initialise with configuration options
101-
var config = {
102-
endpoints: {
103-
api: 'api.differenthost.com',
104-
chat: 'chat.differenthost.com',
105-
muc: 'muc.chat.differenthost.com'
106-
},
107-
chatProtocol: {
108-
bosh: 'https://chat.differenthost.com:5281'
109-
},
110-
debug: true,
111-
timeout: 5000,
112-
ssl: false
113-
};
114-
115-
QB.init(103, "89AO9Z2LobcegCG", "1Hs8XZpMxGRVPnD", config);
116-
117-
```
118-
119-
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.
120-
121-
Documentation
122-
----------------------
55+
# Documentation
12356

12457
You can look at it here http://quickblox.com/developers/Javascript
12558

126-
Questions and feedback
127-
----------------------
59+
# Questions and feedback
12860

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

13163
Feedback and suggestions for improvement always welcome :)
13264

65+
# Modifying and building the library
13366

134-
Creating sessions in more detail
135-
--------------------------------
136-
```
137-
QB.createSession(options, callback)
138-
139-
options: A map of additional options to pass to the method
140-
appId - your application's id (overrides the value passed to QB.init)
141-
authKey - your application's authorization key (overrides the value passed to QB.init)
142-
authSecret - your application's authorization secret (overrides the value passed to QB.init)
143-
login - the QuickBlox username of the person to login
144-
password - the QuickBlox user's password
145-
email - the email address of the QuickBlox user
146-
provider - the name of the social network provider for authenticating via Twitter of Facebook
147-
scope - a list of permisions required by the facebook app
148-
keys - a map of :
149-
token - social network access token
150-
secret - social network access token secret (only required for twitter)
151-
```
152-
153-
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 :)
154-
155-
156-
Modifying and building the library
157-
----------------------------------
15867
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).
15968

16069
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:
@@ -169,4 +78,5 @@ These modules are combined through [browserify](http://browserify.org/) into a s
16978
* `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)
17079
* Update QuickBlox developers section
17180

172-
81+
# License
82+
BSD

0 commit comments

Comments
 (0)