0.3.0 • Published 8 years ago

event-swarm v0.3.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

event-swarm

Cross-machine events made simple.

Build Status Code Coverage Dependencies DevDependencies npm Monthly Downloads Total Downloads

Easily send events across machines on the same network, built using airswarm for network discovery and simple TCP sockets.

Example:

import EventSwarm from 'event-swarm';

// On first machine...
let swarm = new EventSwarm({ channel: 'chat' });

swarm.on('ping', e => {
  // e.sender is the id of the sender.
  // e.data is the payload of the message (automatically (de)serialized).
  // e.event is the event name.
  // e.created is the millisecond timestamp of when the source created it.

  console.log('pong', e.data);
});


// On second machine...
let swarm = new EventSwarm({ channel: 'chat' });

swarm.emit('ping', {
  string: 'Hello!',
  num: 10,
  date: new Date()
});

Features:

  • Built on airswarm.
  • Channels allow for multiple swarms to exist on the same network.
  • Built-in events for connection and disconnection.
  • Broadcast events or send events to specific peers.

Contribute

  1. Fork it
  2. npm i
  3. gulp watch
  4. Make changes and write tests.
  5. Send pull request! :sunglasses:

License:

MIT

0.3.0

8 years ago

0.2.0

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago