Détail du package

libp2p-websockets

libp2p24.3kMIT0.16.2

JavaScript implementation of the WebSockets module that libp2p uses and that implements the interface-transport spec

IPFS

readme

js-libp2p-websockets

Discourse posts Coverage Status Travis CI Circle CI Dependency Status js-standard-style

JavaScript implementation of the WebSockets module that libp2p uses and that implements the interface-transport interface

Lead Maintainer

Jacob Heun

Description

libp2p-websockets is the WebSockets implementation compatible with libp2p.

Usage

Install

npm

> npm i libp2p-websockets

Constructor properties

const WS = require('libp2p-websockets')

const properties = {
  upgrader,
  filter
}

const ws = new WS(properties)
Name Type Description Default
upgrader Upgrader connection upgrader object with upgradeOutbound and upgradeInbound REQUIRED
filter (multiaddrs: Array<Multiaddr>) => Array<Multiaddr> override transport addresses filter Browser: DNS+WSS multiaddrs / Node.js: DNS+{WS, WSS} multiaddrs

You can create your own address filters for this transports, or rely in the filters provided.

The available filters are:

  • filters.all
    • Returns all TCP and DNS based addresses, both with ws or wss.
  • filters.dnsWss
    • Returns all DNS based addresses with wss.
  • filters.dnsWsOrWss
    • Returns all DNS based addresses, both with ws or wss.

Libp2p Usage Example

const Libp2p = require('libp2p')
const Websockets = require('libp2p-websockets')
const filters = require('libp2p-websockets/src/filters')
const MPLEX = require('libp2p-mplex')
const { NOISE } = require('libp2p-noise')

const transportKey = Websockets.prototype[Symbol.toStringTag]
const node = await Libp2p.create({
  modules: {
    transport: [Websockets],
    streamMuxer: [MPLEX],
    connEncryption: [NOISE]
  },
  config: {
    transport: {
      [transportKey]: { // Transport properties -- Libp2p upgrader is automatically added
        filter: filters.dnsWsOrWss
      }
    }
  }
})

For more information see libp2p/js-libp2p/doc/CONFIGURATION.md#customizing-transports.

API

Transport

Connection

changelog

0.16.2 (2021-09-28)

0.16.1 (2021-07-08)

0.16.0 (2021-07-07)

chore

BREAKING CHANGES

  • uses new major of mafmt, multiaddr, etc

0.15.9 (2021-06-11)

0.15.8 (2021-06-08)

Bug Fixes

0.15.7 (2021-05-04)

0.15.6 (2021-04-18)

0.15.5 (2021-04-12)

0.15.4 (2021-03-31)

0.15.3 (2021-02-22)

0.15.2 (2021-02-09)

Bug Fixes

0.15.1 (2021-02-05)

Bug Fixes

0.15.0 (2020-11-24)

Bug Fixes

Features

BREAKING CHANGES

  • Only DNS+WSS addresses are now returned on filter by default in the browser. This can be overritten by the filter option and filters are provided in the module.

0.14.0 (2020-08-11)

Bug Fixes

  • replace node buffers with uint8arrays (#115) (a277bf6)

BREAKING CHANGES

    • All deps used by this module now use Uint8Arrays in place of Buffers
  • chore: remove gh dep

0.13.6 (2020-03-23)

Bug Fixes

0.13.5 (2020-02-26)

Bug Fixes

  • catch thrown maConn errors in listener (8bfb19a)

0.13.4 (2020-02-14)

Bug Fixes

0.13.3 (2020-02-07)

0.13.2 (2019-12-20)

0.13.1 (2019-10-30)

Bug Fixes

0.13.0 (2019-09-30)

Code Refactoring

BREAKING CHANGES

  • Switch to using async/await and async iterators. The transport and connection interfaces have changed. See the README for new usage.

0.12.3 (2019-08-21)

0.12.2 (2019-01-24)

Bug Fixes

  • ipv6 naming with multiaddr-to-uri package (#81) (93ef7c3)

0.12.1 (2019-01-10)

Bug Fixes

0.12.0 (2018-04-30)

0.11.0 (2018-04-05)

Features

0.10.5 (2018-02-20)

0.10.4 (2017-10-22)

0.10.3 (2017-10-22)

0.10.2 (2017-10-20)

Features

0.10.1 (2017-07-22)

0.10.0 (2017-03-27)

Bug Fixes

  • dial: pass through errors from pull-ws onConnect (8df8084)

0.9.6 (2017-03-23)

Bug Fixes

0.9.5 (2017-03-23)

0.9.4 (2017-03-21)

0.9.2 (2017-02-09)

0.9.1 (2016-11-08)

Bug Fixes

0.9.0 (2016-11-03)

Features

0.8.1 (2016-09-06)

Features

  • readme: update pull-streams section (64c57f5)

0.8.0 (2016-09-06)

Features

  • pull: migrate to pull streams (3f58dca)
  • readme: complete the readme, adding reference about pull-streams (b62560e)

0.7.2 (2016-08-29)

Bug Fixes

  • style: reduce nested callbacks (33f5fb3)

0.7.1 (2016-08-03)

0.7.0 (2016-06-22)

0.6.1 (2016-05-29)

0.6.0 (2016-05-22)

0.5.0 (2016-05-17)

0.4.4 (2016-05-08)

Bug Fixes

0.4.3 (2016-05-08)

0.4.1 (2016-04-25)

0.3.2 (2016-04-14)

0.2.2 (2016-04-14)

0.2.1 (2016-03-20)

0.2.0 (2016-03-14)

0.1.0 (2016-02-26)