Skip to content

Node.js port of Zyre - an open-source framework for proximity-based peer-to-peer applications

License

Notifications You must be signed in to change notification settings

webjinx/zyre.js

Repository files navigation

zyre.js

Build Status Build status codecov

Node.js port of Zyre - an open-source framework for proximity-based peer-to-peer applications

Notice

This project is currently in development and not considered stable yet.

Installation

npm install zyre.js

Documentation

A jsdoc documentation can be found here.

Examples

There is a sample chat package, that can be found here.

Inline example of two nodes talking to each other:

const zyre = require('zyre.js');

const z1 = zyre.new({ name: 'z1' });
const z2 = zyre.new({ name: 'z2' });

z1.on('shout', (id, name, message, group) => {
  console.log(`#${group} <${name}> ${message}`);
});

z2.on('shout', (id, name, message, group) => {
  console.log(`#${group} <${name}> ${message}`);
  z2.shout('CHAT', 'Hey!');
});

z1.start().then(() => {
  z1.join('CHAT');
  z2.start().then(() => {
    z2.join('CHAT');
  });
});

setInterval(() => {
  z1.shout('CHAT', 'Hello World!');
}, 1000);

About

Node.js port of Zyre - an open-source framework for proximity-based peer-to-peer applications

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%