welitejs

1.1.9 • Public • Published

welitejs

A lightweight JavaScript library for WeYouMe

Install

npm install welitejs --save

Usage

var welitejs = require('welitejs');

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

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

Promises

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

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

It'll add a Async to all welitejs 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.

/welitejs/

    Package Sidebar

    Install

    npm i welitejs

    Weekly Downloads

    21

    Version

    1.1.9

    License

    MIT

    Unpacked Size

    11.7 kB

    Total Files

    6

    Last publish

    Collaborators

    • lopu