dht-universal
Universal wrapper for @hyperswarm/dht
and @hyperswarm/dht-relay
working in Node.js and the Browser
Installation
npm install dht-universal
Usage
In browser, it will use the @hyperswarm/dht-relay
with a WebSocket
transport, so you need to pass a relay URL to the constructor, and wait for it to be ready to confirm the websocket is open.
Custom relays
import { DHT } from 'dht-universal';
const node = new DHT({ relay: 'wss://dht-relay.example.com/' });
await node.ready();
API
Should be the same as @hyperswarm/dht.
Covered by tests and type definitions:
-
Tested in normal DHT
-
Passing in Relay