libp2p-webrtc-star
libp2p WebRTC transport that includes a discovery mechanism provided by the signalling-star
Last updated 4 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

Table of Contents

Description

libp2p-webrtc-star is one of the WebRTC transports available for libp2p.

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 all = require('it-all')

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 all(socket)

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

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

Signalling server

This module has an accompanying signalling server which is used to discover other peers running the libp2p-webrtc-star transport.

Please see the libp2p-webrtc-star-signalling-server module for more information.

API

Transport

Connection

Peer Discovery - ws.discovery

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
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (22)
Dev Dependencies (10)

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