ataraxia-hyperswarm
v0.12.0
Published
Hyperswarm transport for Ataraxia P2P messaging
Downloads
5
Readme
ataraxia-hyperswarm
Hyperswarm transport for Ataraxia. This transport discovers and connects to peers using a specific topic via the public Internet using Hyperswarm.
Installation
npm install ataraxia-hyperswarm
Usage
Create a transport that will connect to and discover peers based on a specific topic:
import { Network, AnonymousAuth } from 'ataraxia';
import { HyperswarmTransport } from 'ataraxia-hyperswarm';
// Setup a network over Hyperswarm
const net = new Network({
name: 'name-of-your-app-or-network',
transports: [
new HyperswarmTransport({
// Topic used to find peers
topic: 'Unique Topic',
// Setup anonymous authentication
authentication: [
new AnonymousAuth()
]
})
]
});
// Join the network
await net.join();
API
new HyperswarmTransport(options)
Create a new instance of this transport.
options
topic: string
, topic used to discover peers. The transport will attempt to connect to other peers using the same topic so making it unique to your app or use case is important.authentication: AuthProvider[]
, providers to use for authentication of found peers.