Jacob Heun fcb6bcc378
test: fix skips (#95)
The ephemeral port and host skips are no longer valid, so tests have been added for those.
The other skipped test is now covered by the interface tests, so it's no longer needed.

* chore: add node 12 to ci
* chore: add docs and dist to gitignore
* chore: clean up travis file
2019-09-30 13:08:57 +02:00
2019-09-30 13:08:57 +02:00
2019-09-30 13:08:57 +02:00
2019-09-30 13:08:57 +02:00
2019-08-21 17:17:15 +02:00
2016-02-25 12:21:14 +00:00

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

Example

const WS = require('libp2p-websockets')
const multiaddr = require('multiaddr')
const pipe = require('it-pipe')
const { collect } = require('streaming-iterables')

const addr = multiaddr('/ip4/0.0.0.0/tcp/9090/ws')

const ws = new WS({ 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

Description
No description provided
Readme 1.5 MiB
Languages
JavaScript 100%