Skip to content

weyoume/welitejs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A lightweight Javascript library for the WeYouMe ecosystem

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 96.2%
  • Shell 3.8%