ataraxia-hyperswarm
TypeScript icon, indicating that this package has built-in type declarations

0.12.0 • Public • Published

ataraxia-hyperswarm

npm version Dependencies Typedoc

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.

Keywords

none

Install

npm i ataraxia-hyperswarm

DownloadsWeekly Downloads

0

Version

0.12.0

License

MIT

Unpacked Size

49.8 kB

Total Files

17

Last publish

Collaborators

  • aholstenson