Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
"yoda": [2, "never"]
},
"env": {
"node": true
"node": true,
"mocha": true
},
"extends": "eslint:recommended"
}
18 changes: 9 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ sudo: false
language: node_js
node_js:
- '4.2.6'
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- gcc-4.9
- g++-4.9
script:
- grunt && npm test && cat ./coverage/lcov.info | ./node_modules/.bin/codecov
before_install: npm install -g grunt-cli
install: npm install

- grunt && npm test && cat ./coverage/lcov.info | ./node_modules/.bin/codecov
before_install:
- export CC="gcc-4.9" CXX="g++-4.9"
- npm install -g grunt-cli
install:
- npm install
after_success:
- chmod 755 ${TRAVIS_BUILD_DIR}/deploy.sh && sh -c "${TRAVIS_BUILD_DIR}/deploy.sh"

env:
global:
secure: EZ+XXJFDtehmag7wt8JbutqgzpkkJUCzkEWw6W+p7MIxWenLyuGv/RUu7KGqAloOud1cZbmZGSfRx/vsPvxRjo+ZC7aaPqb74qRvfctGdlJTtEffS2jFno1pEppJzCR4n7vocSfMVYtOD6oHP67lXwn/Qnh++WUkZaV137m5+7rqiYgJ+JTeSs5jBRZ6X7VNoNz8tZXejQ+FOymCFQTS2JM/rSZX9NEK+OwUEhEjRcxqWMm2avk6NAQNAL3WQuIBJQH8lxEJxOXkMc0rQZZ09AoLpqJKzsaicaZMInt5JstPo2e9vJfhi+PpRSNhErIff36aCHWRYYDPKl5x6IelZpBfZeTdrs4V2TbRi1y0ELbgMG1FHS4HAw3vTnh4/49g01lAJed4UguFRc6MzwTLAL8uPG/zFe8snm9+kaf4pL7yO89Hf3eltE03+N//tyVv+X/jdSca2dBZ9FMeLE5pJ2jlRiKitCLjXmLUEMMxEwNF7K/IvOrD9wue3JXK0UogOpcXfppk++pNTijsZluU1Yj7k3fGFeS8d6rIU0Yj40y6/VMaJeL4EXlARRsGLigUKVjQL6+/N5xudlsCng+EG+WVIy4wEEPH0QgjUkPTgWx1NrUlTwjskE0cdqDOBu39WkRFJHHECYFPTfTuDJ7xxuuibFTQmUFu2zjbYfYKhPE=
Expand Down
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function(grunt) {
src: ['src/kuzzle.js'],
dest: 'dist/kuzzle.js',
options: {
exclude: ['socket.io-client'],
exclude: ['socket.io-client', 'ws', './src/networkWrapper/wrappers/wsnode.js'],
browserifyOptions: {
noParse: [require.resolve('node-uuid')]
}
Expand Down
34 changes: 30 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[![Build Status](https://travis-ci.org/kuzzleio/sdk-javascript.svg?branch=master)](https://travis-ci.org/kuzzleio/sdk-javascript) [![codecov.io](http://codecov.io/github/kuzzleio/sdk-javascript/coverage.svg?branch=master)](http://codecov.io/github/kuzzleio/sdk-javascript?branch=master) [![Dependency Status](https://david-dm.org/kuzzleio/sdk-javascript.svg)](https://david-dm.org/kuzzleio/sdk-javascript)


Official Kuzzle Javascript SDK
Official Kuzzle Javascript SDK
======

This SDK version is compatible with Kuzzle 1.0.0-beta.1 and higher
This SDK version is compatible with Kuzzle 1.0.0-RC5 and higher

Please use SDK v1.x for earlier versions of Kuzzle.

## About Kuzzle

Expand All @@ -13,18 +15,38 @@ For UI and linked objects developers, Kuzzle is an open-source solution that han
You can access the Kuzzle repository on [Github](https://github.com/kuzzleio/kuzzle)

* [SDK Documentation](#sdk-documentation)
* [Protocols used](#protocols-used)
* [Installation](#installation)
* [NodeJS](#nodejs)
* [Basic usage](#basic-usage-node)
* [Javascript](#javascript)
* [Basic usage](#basic-usage-js)
* [Building manually](#building-manually)
* [Migrating from SDK v1.x](#migrating-from-sdk-v1.x)
* [License](#license)

## SDK Documentation

The complete SDK documentation is available [here](http://kuzzleio.github.io/sdk-documentation)

## Protocols used

The SDK Javascript implements two network protocols: raw WebSocket, and [Socket.IO](http://socket.io/)
The main reason behind this is that while Socket.IO offers better compatibility with older web browsers, our raw WebSocket implementation is about 20% faster

For this reason, there is a slight difference with the [generic SDK documentation](http://kuzzleio.github.io/sdk-documentation): instead of 1 available `port` option, there are actually a `wsPort` and a `ioPort` options.
These options are defaulted to Kuzzle default protocol plugins.

What protocol is used when you connect to Kuzzle depends on multiple factors:

#### NodeJS

The protocol used is always raw WebSocket.

#### Web Browsers

The SDK will first try to use raw WebSocket to connect to Kuzzle. If the web browser does not support this protocol, then the SDK falls back to Socket.IO

## Installation

This SDK can be used either in NodeJS or in a browser.
Expand All @@ -40,7 +62,7 @@ npm install kuzzle-sdk --save
```javascript
var
Kuzzle = require('kuzzle-sdk'),
kuzzle = new Kuzzle('http://foobar:7512');
kuzzle = new Kuzzle('serverName');

var myDoc = {
name: 'Rick Astley',
Expand Down Expand Up @@ -93,7 +115,7 @@ bower install kuzzle-sdk --save

```javascript
var
kuzzle = new Kuzzle('http://foobar:7512');
kuzzle = new Kuzzle('serverName');

var myDoc = {
name: 'Rick Astley',
Expand All @@ -119,6 +141,10 @@ kuzzle

Clone this github repository and run ``grunt``. A ``dist`` directory will be created, containing a plain browserified version of this SDK, and a minified version.

## Migrating from SDK v1.x

* Kuzzle constructor has been changed. Instead of an URL, you have to provide a resolvable server name, or an IP address. If you need to specify a port different than the provided default values, you can do so using these two new options: `wsPort` (WebSocket port) and `ioPort` (Socket.IO port)

## License

[Apache 2](LICENSE.md)
Loading