Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bonustrack/kbyte

Repository files navigation

kbyte.js

A lightweight JavaScript library for Obyte

Install

kbyte was designed to work both in the browser and in Node.js.

Node.js

To install kbyte on Node.js, open your terminal and run:

npm install kbyte

Browser

You can create an index.html file and include kbyte with:

<script src="https://cdn.jsdelivr.net/npm/kbyte">script>

Usage

var kbyte = require('kbyte');

// Init WebSocket client
var client = new kbyte.Client('wss://obyte.org/bb');

// Get peers
client.request('get_peers', null, function(err, result) {
console.log(err, result);
});

See more examples

Promises

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

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

It'll add a Async to all kbyte functions (e.g. return client.requestAsync().then()) client.request('get_peers', null, function(err, result) { console.log(err, result); });

['wss://byteroll.com/bb', 'wss://byteball.fr/bb' ...] });">// So instead of writing client.request('get_peers', null, cb); you have to write:
client.requestAsync('get_peers', null).then(function(result) {
console.log(result); // => ['wss://byteroll.com/bb', 'wss://byteball.fr/bb' ...]
});

License

MIT.

About

A lightweight JavaScript library for Obyte

Topics

Resources

Readme

License

WTFPL license

Code of conduct

Code of conduct

Contributing

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors