libp2p-webrtc-star
libp2p WebRTC transport that includes a discovery mechanism provided by the signalling-star
Last updated 5 years ago by vascosantos .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install libp2p-webrtc-star 
SYNC missed versions from official npm registry.

js-libp2p-webrtc-star

Discourse posts Dependency Status js-standard-style

libp2p WebRTC transport that includes a discovery mechanism provided by the signalling-star

Lead Maintainer

Vasco Santos.

Description

libp2p-webrtc-star is one of the WebRTC transports available for libp2p. libp2p-webrtc-star incorporates both a transport and a discovery service that is facilitated by the signalling server, also part of this module.

Usage

Install

> npm install libp2p-webrtc-star

Usage

Using this module in Node.js (read: not in the browser)

To use this module in Node.js, you have to BYOI of WebRTC, there are multiple options out there, unfortunately, none of them are 100% solid. The ones we recommend are: wrtc and electron-webrtc.

Instead of just creating the WebRTCStar instance without arguments, you need to pass an options object with the WebRTC implementation:

const wrtc = require('wrtc')
const electronWebRTC = require('electron-webrtc')
const WStar = require('libp2p-webrtc-star')

// Using wrtc
const ws1 = new WStar({ wrtc: wrtc })

// Using electron-webrtc
const ws2 = new WStar({ wrtc: electronWebRTC() })

Using this module in the Browser

const WStar = require('libp2p-webrtc-star')
const multiaddr = require('multiaddr')
const pipe = require('it-pipe')
const { collect } = require('streaming-iterables')

const addr = multiaddr('/ip4/188.166.203.82/tcp/20000/wss/p2p-webrtc-star/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSooo2a')

const ws = new WStar({ upgrader })

const listener = ws.createListener((socket) => {
  console.log('new connection opened')
  pipe(
    ['hello'],
    socket
  )
})

await listener.listen(addr)
console.log('listening')

const socket = await ws.dial(addr)
const values = await pipe(
  socket,
  collect
)

console.log(`Value: ${values.toString()}`)

// Close connection after reading
await listener.close()

API

Transport

Connection

Peer Discovery - ws.discovery

Rendezvous server (aka Signalling server)

Nodes using libp2p-webrtc-star will connect to a known point in the network, a rendezvous point where they can learn about other nodes (Discovery) and exchange their SDP offers (signalling data).

libp2p-webrtc-star comes with its own signalling server, used for peers to handshake their signalling data and establish a connection. You can install it in your machine by installing the module globally:

> npm install --global libp2p-webrtc-star

This will expose a webrtc-star cli tool. To spawn a server do:

> star-signal --port=13579 --host=127.0.0.1

Defaults:

  • port - 9090
  • host - '0.0.0.0'

Hosted Rendezvous Server

We host a signalling server at star-signal.cloud.ipfs.team that can be used for practical demos and experimentation, it should not be used for apps in production. A libp2p-webrtc-star address, using the signalling server we provide, looks like:

/dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star/p2p/<your-peer-id>

Note: The address above indicates WebSockets Secure, which can be accessed from both http and https.

Current Tags

  • 0.21.0                                ...           beta (4 years ago)
  • 0.25.0                                ...           latest (3 years ago)

97 Versions

  • 0.25.0                                ...           3 years ago
  • 0.24.1                                ...           3 years ago
  • 0.24.0                                ...           3 years ago
  • 0.23.0                                ...           3 years ago
  • 0.22.4                                ...           4 years ago
  • 0.22.3                                ...           4 years ago
  • 0.22.2                                ...           4 years ago
  • 0.22.1                                ...           4 years ago
  • 0.22.0                                ...           4 years ago
  • 0.21.2                                ...           4 years ago
  • 0.21.1                                ...           4 years ago
  • 0.21.0                                ...           4 years ago
  • 0.20.8                                ...           4 years ago
  • 0.20.7                                ...           4 years ago
  • 0.20.6                                ...           4 years ago
  • 0.20.5                                ...           4 years ago
  • 0.20.4                                ...           4 years ago
  • 0.20.3                                ...           4 years ago
  • 0.20.2                                ...           4 years ago
  • 0.20.1                                ...           4 years ago
  • 0.20.0                                ...           4 years ago
  • 0.19.0                                ...           4 years ago
  • 0.18.6                                ...           5 years ago
  • 0.18.5                                ...           5 years ago
  • 0.18.4                                ...           5 years ago
  • 0.17.11                                ...           5 years ago
  • 0.18.3                                ...           5 years ago
  • 0.18.1                                ...           5 years ago
  • 0.17.10                                ...           5 years ago
  • 0.18.0                                ...           5 years ago
  • 0.17.9                                ...           5 years ago
  • 0.17.8                                ...           5 years ago
  • 0.17.7                                ...           5 years ago
  • 0.17.6                                ...           5 years ago
  • 0.17.5                                ...           5 years ago
  • 0.17.4                                ...           5 years ago
  • 0.17.3                                ...           5 years ago
  • 0.17.2                                ...           5 years ago
  • 0.17.1                                ...           5 years ago
  • 0.17.0                                ...           5 years ago
  • 0.16.1                                ...           6 years ago
  • 0.16.0                                ...           6 years ago
  • 0.15.8                                ...           6 years ago
  • 0.15.7                                ...           6 years ago
  • 0.15.6                                ...           6 years ago
  • 0.15.5                                ...           6 years ago
  • 0.15.4                                ...           6 years ago
  • 0.15.3                                ...           7 years ago
  • 0.15.1                                ...           7 years ago
  • 0.15.2                                ...           7 years ago
  • 0.15.0                                ...           7 years ago
  • 0.14.0                                ...           7 years ago
  • 0.13.4                                ...           7 years ago
  • 0.13.3                                ...           7 years ago
  • 0.13.2                                ...           7 years ago
  • 0.13.1                                ...           7 years ago
  • 0.13.0                                ...           7 years ago
  • 0.12.0                                ...           7 years ago
  • 0.11.0                                ...           7 years ago
  • 0.10.1                                ...           8 years ago
  • 0.10.0                                ...           8 years ago
  • 0.9.0                                ...           8 years ago
  • 0.8.10                                ...           8 years ago
  • 0.8.8                                ...           8 years ago
  • 0.8.7                                ...           8 years ago
  • 0.8.6                                ...           8 years ago
  • 0.8.5                                ...           8 years ago
  • 0.8.4                                ...           8 years ago
  • 0.8.3                                ...           8 years ago
  • 0.8.1                                ...           8 years ago
  • 0.8.0                                ...           8 years ago
  • 0.7.5                                ...           8 years ago
  • 0.7.4                                ...           8 years ago
  • 0.7.3                                ...           8 years ago
  • 0.7.2                                ...           8 years ago
  • 0.7.1                                ...           8 years ago
  • 0.7.0                                ...           8 years ago
  • 0.6.1                                ...           8 years ago
  • 0.6.0                                ...           8 years ago
  • 0.5.0                                ...           8 years ago
  • 0.4.5                                ...           8 years ago
  • 0.4.4                                ...           8 years ago
  • 0.4.3                                ...           8 years ago
  • 0.4.1                                ...           8 years ago
  • 0.4.0                                ...           8 years ago
  • 0.3.2                                ...           8 years ago
  • 0.3.1                                ...           9 years ago
  • 0.3.0                                ...           9 years ago
  • 0.2.3                                ...           9 years ago
  • 0.2.2                                ...           9 years ago
  • 0.2.1                                ...           9 years ago
  • 0.2.0                                ...           9 years ago
  • 0.1.4                                ...           9 years ago
  • 0.1.3                                ...           9 years ago
  • 0.1.2                                ...           9 years ago
  • 0.1.1                                ...           9 years ago
  • 0.1.0                                ...           9 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (23)
Dev Dependencies (8)

© 2010 - cnpmjs.org x YWFE | Home | YWFE