@ericet/buzzjs

1.0.0 • Public • Published

Buzz.js

A lightweight JavaScript library for Buzz

Install

npm install buzzjs --save

Usage

var buzz = require('buzz');

// Init WebSocket client
var client = new buzz.Client('wss://notifications.blurt.world');

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

Promises

You can also use Buzz.js with promises by promisifying buzz with bluebird as in:

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

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

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

License

MIT.

Readme

Keywords

none

Package Sidebar

Install

npm i @ericet/buzzjs

Weekly Downloads

50

Version

1.0.0

License

MIT

Unpacked Size

11.8 kB

Total Files

6

Last publish

Collaborators

  • ericet