Options
All
  • Public
  • Public/Protected
  • All
Menu

Ataraxia

Connect nodes, such as NodeJS-apps or browsers, together and send messages between them. Provides a mesh network with peer-to-peer messaging, allowing messages to be routed between nodes that are not directly connected with each other.

  • Instances can send and receive messages from other instances
  • Partially connected mesh network, messages will be routed to their target if needed
  • Authentication support, anonymous and shared secret authentication available in core
  • Encryption, most transports establish an encrypted connection by default
  • RPC, register and consume services anywhere in the network, supports method call and events, via ataraxia-services
  • Support for different transports

Getting started

To setup your own network install the ataraxia package and at least one transport such as ataraxia-tcp:

$ npm install ataraxia ataraxia-tcp

A network can then be created and joined:

import { Network, AnonymousAuth } from 'ataraxia';
import { TCPTransport, TCPPeerMDNSDiscovery } from 'ataraxia-tcp';

const net = new Network({
name: 'ataraxia-example',
transports: [
new TCPTransport({
discovery: new TCPPeerMDNSDiscovery(),
authentication: [
new AnonymousAuth()
]
})
]
});

net.onNodeAvailable(node => {
console.log('A new node is available:', node.id);
node.send('hello')
.catch(err => console.log('Unable to send hello'));
});

net.onMessage(msg => {
console.log('A message was received', msg.type, 'with data', msg.data, 'from', msg.source.id);
});

// Join the network
await net.join();

Generated using TypeDoc