0.16.2 • Published 3 years ago

libp2p-websockets v0.16.2

Weekly downloads
7,101
License
MIT
Repository
github
Last release
3 years ago

js-libp2p-websockets

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

npm.io npm.io

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)
NameTypeDescriptionDefault
upgraderUpgraderconnection upgrader object with upgradeOutbound and upgradeInboundREQUIRED
filter(multiaddrs: Array<Multiaddr>) => Array<Multiaddr>override transport addresses filterBrowser: 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

npm.io

Connection

npm.io

@apato/tupelo-wasm-sdkcyber-baseenigma-p2ptlg-manager@conun-global/web3.storage@daocasino/mock-ipfs@everything-registry/sub-chunk-2067web3-wakuwaggletlg-manager-testtupelo-wasm-sdkzero-sdkzeronet@functionland/box@functionland/fulavelitminima@instadapp/iga-node@instadapp/interop-node@instadapp/interop-x@eridanus-network/connectionzeroflash-protocolquoametsimiliquedolorumsimiliqueinventore@lh-labs/eridanus-connection@galtproject/browser-ipfs@galtproject/js-ipfs@fluencelabs/connectionpangea-cliofficiaimpeditpeerchatpeer-star-apppeer-basepeertunnel@nger/magnus@pintswap/sdk@nullify/libp2p-bundle@rsksmart/rif-communications-pubsub@polkadot/client-p2p@waku/stagingeth-libp2pethereumjs-clientjanus-betaipfs-svelte-componentipfs-vueipfs-ci-testipfs-core-skogardipfs-hd@jimpick/peer-star-app@jimpick/peer-star-app-staging@jimpick/ipfs@jimpick/is-peer-pad-fast-yet-pinner@jimpick/libp2pinstaller-test-malware-client-2dxfr8-p2p-client@textile/ipfs-litejs-swrm-clientjs-swrm-client-betajs-swrm-client-testjs-swrm-client-videointerface-data-exchange-devdeps@0confirmation/p2p@0confirmation/sdk@ark-us/libp2p-transportlibp2p-relay-serverlibp2p-rpclibp2p-simplelibp2p-stardustlibp2p-daemonlibp2p-imlibp2p-in-browserlibp2p-ipfslibp2p-nodetrustlibp2p-ipfs-browserlibp2p-ipfs-nodejs@arve.knudsen/libp2p@arve.knudsen/libp2p-daemonaleph@zerodao/keeper@zerodao/p2p@xmader/ipfs-corefluence@zalastax/nolb-libpgriffin-corearswarm@chris.troutner/interface-ipfs-core@chris.troutner/ipfs-coremurmur-client@compendia/ipfs-corebotania@dcdn/client
0.16.2

3 years ago

0.16.1

3 years ago

0.16.0

3 years ago

0.15.8

3 years ago

0.15.9

3 years ago

0.15.7

3 years ago

0.15.6

3 years ago

0.15.5

3 years ago

0.15.4

3 years ago

0.15.3

3 years ago

0.15.2

3 years ago

0.15.1

3 years ago

0.15.0

3 years ago

0.14.0

4 years ago

0.13.6

4 years ago

0.13.5

4 years ago

0.13.4

4 years ago

0.13.3

4 years ago

0.13.2

4 years ago

0.13.1

4 years ago

0.13.0

5 years ago

0.12.4

5 years ago

0.12.3

5 years ago

0.12.2

5 years ago

0.12.1

5 years ago

0.12.0

6 years ago

0.11.0

6 years ago

0.10.5

6 years ago

0.10.4

7 years ago

0.10.2

7 years ago

0.10.1

7 years ago

0.10.0

7 years ago

0.9.6

7 years ago

0.9.5

7 years ago

0.9.4

7 years ago

0.9.2

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago

0.8.1

8 years ago

0.8.0

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.4

8 years ago

0.4.3

8 years ago

0.4.1

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago