libp2p-websockets
JavaScript implementation of the WebSockets module that libp2p uses and that implements the interface-transport spec
Last updated 7 years ago by daviddias .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install libp2p-websockets 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.15.0                                ...           beta (4 years ago)
  • 0.16.2                                ...           latest (3 years ago)

56 Versions

  • 0.16.2                                ...           3 years ago
  • 0.16.1                                ...           3 years ago
  • 0.16.0                                ...           3 years ago
  • 0.15.9                                ...           4 years ago
  • 0.15.8                                ...           4 years ago
  • 0.15.7                                ...           4 years ago
  • 0.15.6                                ...           4 years ago
  • 0.15.5                                ...           4 years ago
  • 0.15.4                                ...           4 years ago
  • 0.15.3                                ...           4 years ago
  • 0.15.2                                ...           4 years ago
  • 0.15.1                                ...           4 years ago
  • 0.15.0                                ...           4 years ago
  • 0.14.0                                ...           4 years ago
  • 0.13.6                                ...           5 years ago
  • 0.13.5                                ...           5 years ago
  • 0.13.4                                ...           5 years ago
  • 0.13.3                                ...           5 years ago
  • 0.13.2                                ...           5 years ago
  • 0.13.1                                ...           5 years ago
  • 0.13.0                                ...           5 years ago
  • 0.12.4                                ...           5 years ago
  • 0.12.3                                ...           5 years ago
  • 0.12.2                                ...           6 years ago
  • 0.12.1                                ...           6 years ago
  • 0.12.0                                ...           7 years ago
  • 0.11.0                                ...           7 years ago
  • 0.10.5                                ...           7 years ago
  • 0.10.4                                ...           7 years ago
  • 0.10.2                                ...           7 years ago
  • 0.10.1                                ...           7 years ago
  • 0.10.0                                ...           8 years ago
  • 0.9.6                                ...           8 years ago
  • 0.9.5                                ...           8 years ago
  • 0.9.4                                ...           8 years ago
  • 0.9.2                                ...           8 years ago
  • 0.9.1                                ...           8 years ago
  • 0.9.0                                ...           8 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                                ...           9 years ago
  • 0.6.1                                ...           9 years ago
  • 0.6.0                                ...           9 years ago
  • 0.5.0                                ...           9 years ago
  • 0.4.4                                ...           9 years ago
  • 0.4.3                                ...           9 years ago
  • 0.4.1                                ...           9 years ago
  • 0.3.2                                ...           9 years ago
  • 0.3.1                                ...           9 years ago
  • 0.3.0                                ...           9 years ago
  • 0.2.2                                ...           9 years ago
  • 0.2.1                                ...           9 years ago
  • 0.2.0                                ...           9 years ago
  • 0.1.0                                ...           9 years ago
Maintainers (1)
Downloads
Total 1
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (9)

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