welightjs

1.1.1 • Public • Published

welightjs

A lightweight JavaScript library for welightjs

Install

npm install welightjs --save

Usage

var welightjs = require('welightjs');

// Init WebSocket client
var client = new welightjs.Client('wss://peer.ezira.io:8090');

// Get accounts
client.call('get_accounts', ['fabien'], function(err, result) {
  console.log(err, result);
});

Promises

You can also use welightjs with promises by promisifying welightjs with bluebird as in:

var welightjs = require('welightjs');
bluebird.promisifyAll(welightjs.Client.prototype);

It'll add a Async to all welightjs functions (e.g. return client.callAsync().then())

// So instead of writing client.request('get_accounts', ['fabien'], cb); you have to write:
return client.callAsync('get_accounts', ['fabien']).then(function(result) {
  console.log(result); // => [{ id: 26921, name: 'fabien' ...]
});

License

MIT.

Readme

Keywords

none

Package Sidebar

Install

npm i welightjs

Weekly Downloads

2

Version

1.1.1

License

MIT

Unpacked Size

19.9 kB

Total Files

9

Last publish

Collaborators

  • lopu