@arve.knudsen/libp2p-daemon-client
v0.1.11
Published
libp2p-daemon client implementation
Downloads
7
Readme
libp2p-daemon client JavaScript implementation
A Javascript client to interact with a standalone deployment of a libp2p host, running in its own OS process. Essentially, this client allows to communicate with other peers, interact with the DHT, participate in pubsub, etc. no matter the language they are implemented with.
Lead Maintainer
Table of Contents
Specs
The specs for the daemon are currently housed in the go implementation. You can read them at libp2p/go-libp2p-daemon
Install
npm install libp2p-daemon-client
Usage
Run a daemon process
There are currently two implementations of the libp2p-daemon
:
Interact with the daemon process using the client
const Client = require('libp2p-daemon-client')
const defaultSock = '/tmp/p2pd.sock'
const client = new Client(defaultSock)
// connect to a daemon
await client.attach()
// interact with the daemon
let identify
try {
identify = await client.identify()
} catch (err) {
// ...
}
// close the socket
await client.close()
API
- Getting started
attach
close
connect
identify
listPeers
openStream
registerStream
dht.put
dht.get
dht.findPeer
dht.provide
dht.findProviders
dht.getClosestPeers
dht.getPublicKey
Contribute
This module is actively under development. Please check out the issues and submit PRs!
License
MIT © Protocol Labs