Options
All
  • Public
  • Public/Protected
  • All
Menu

Hyperswarm based transport. This transport will connect to Hyperswarm and attempt to find peers that are published under a specific topic. When peers are found they will be connected to, a secure channel established and authentication will occur.

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();

Hierarchy

Index

Constructors

constructor

Properties

Protected debug

debug: Debugger

Protected Readonly peers

peers: Set<Peer>

Accessors

onPeerConnect

  • get onPeerConnect(): Subscribable<this, [peer: Peer]>
  • Event for when a new peer is connected via this transport.

    Returns Subscribable<this, [peer: Peer]>

    Subscribable that can be used to register listeners

started

  • get started(): boolean

transportOptions

Methods

Protected addPeer

  • addPeer(peer: Peer): void

start

stop

  • stop(): Promise<boolean>

Generated using TypeDoc