Authorify Websocket
A plugin for Authorify that enable websockets. A provided router allow to use both http and websockets like a REST server. When the plugin is loaded it is available under the main namespace of the host application: app.plugin['your short plugin name'].
Prerequisites
This plugin must be installed both in server and client, respectively in conjunction with Authorify and Authorify-Client.
Installation
Install authorify-websocket
as usual:
$ npm install --save authorify-websocket
Usage
Server
var restify = ;var authorify = //... options;// create the http servervar server = restify;// add plugin to the serverauthorify;// get the loaded pluginvar ws = authorifypluginws;// create the websocket serverws;var router = wsrouter;// add routesrouter;router;router;router;// start the serverserver;
Client (Node)
// create the clientvar client = //... options;// add plugin to the clientclient;
Client (browser)
To create a single file to use in browser environment use a simple script that uses browserify
:
$ ./build.sh
and add the obtained authorify-websocket.js
file to your html
file.
NOTE: this file must be added AFTER authorify.js
(the client) and BEFORE your script (index.js
in this example):
// index.jsvar client = authorify; // authorify is a global exposed by authorify-client// configure the clientclient;// load pluginclient;// request a resourcevar message = field1: 'value1' field2: 'value2' ;client ;
// index.html // this is the browser version of Authorify-Client
Run Tests
Au usual we use mocha as test framework and you can run all tests simply typing:
$ npm test
A full test for both server and client side is available into authorify package.
For more information about the client please read authorify-client documentation and the local documentation into doc` folder.
Documentation
To create your own documentation you must install JSDuck and type in your terminal:
$ cd /path-of-package
$ ./gen_doc.sh
See full documentation into doc folder.
Convention
The version number is laid out as: major.minor.patch and tries to follow semver as closely as possible but this is how we use our version numbering:
major
A major and possible breaking change has been made in the authorify core. These changes could be not backwards compatible with older versions.
minor
New features are added or a big change has happened with one of the third party libraries.
patch
A bug has been fixed, without any major internal and breaking changes.
Contributing
To contribute to the project follow the GitHub guidelines.
License
This program is released under a GNU Affero General Public License version 3 or above, which in summary means:
- You can use this program for no cost.
- You can use this program for both personal and commercial reasons.
- You do not have to share your own program's code which uses this program.
- You have to share modifications (e.g bug-fixes) you've made to this program.
For more convoluted language, see the LICENSE file.