Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: libp2p/js-libp2p-websockets
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e7ab32f0be1300f1adaff1b7cc7039c9e88ce50c
Choose a base ref
...
head repository: libp2p/js-libp2p-websockets
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b5496fbc2190241c856cb94bb32bcb25af128bb8
Choose a head ref

Commits on Apr 5, 2018

  1. Copy the full SHA
    709989a View commit details
  2. feat: add class-is module (#72)

    fsdiogo authored and daviddias committed Apr 5, 2018
    Copy the full SHA
    f59cf88 View commit details
  3. chore: update deps

    daviddias committed Apr 5, 2018
    Copy the full SHA
    ce830d4 View commit details
  4. chore: update contributors

    daviddias committed Apr 5, 2018
    Copy the full SHA
    dd5c63d View commit details
  5. Copy the full SHA
    887dc13 View commit details

Commits on Apr 24, 2018

  1. Fix #70 - Better error for .createServer in browser (#73)

    * Fix #70 - Better error for .createServer in browser
    
    * Add test for throw
    
    * Make test sync
    mkg20001 authored and daviddias committed Apr 24, 2018
    Copy the full SHA
    9ffe03a View commit details

Commits on Apr 30, 2018

  1. chore: update deps

    daviddias committed Apr 30, 2018
    Copy the full SHA
    3ca4829 View commit details
  2. chore: update contributors

    daviddias committed Apr 30, 2018
    Copy the full SHA
    1d0e97d View commit details
  3. Copy the full SHA
    11b62d6 View commit details

Commits on Jun 26, 2018

  1. chore: add lead maintainer (#75)

    * chore: add lead maintainer
    
    License: MIT
    Signed-off-by: Jacob Heun <jacobheun@gmail.com>
    
    * Update package.json
    Jacob Heun authored Jun 26, 2018
    Copy the full SHA
    d661bb6 View commit details

Commits on Jan 8, 2019

  1. docs: added example to README (#80)

    The example is adapted from the example in js-libp2p-tcp
    nikor authored and jacobheun committed Jan 8, 2019
    Copy the full SHA
    c26ae32 View commit details

Commits on Jan 10, 2019

  1. fix: reduce bundle size

    hugomrdias authored and jacobheun committed Jan 10, 2019
    Copy the full SHA
    68ae2c3 View commit details
  2. chore: update deps

    hugomrdias authored and jacobheun committed Jan 10, 2019
    Copy the full SHA
    b37b681 View commit details
  3. chore: update contributors

    jacobheun committed Jan 10, 2019
    Copy the full SHA
    8c2d2ad View commit details
  4. chore: release version v0.12.1

    License: MIT
    Signed-off-by: Jacob Heun <jacobheun@gmail.com>
    jacobheun committed Jan 10, 2019
    Copy the full SHA
    24541d3 View commit details

Commits on Jan 24, 2019

  1. fix: ipv6 naming with multiaddr-to-uri package (#81)

    * chore: use multiaddr-to-uri package
    
    * fix: ipv6 naming with multiaddr-to-uri
    vasco-santos authored and jacobheun committed Jan 24, 2019
    Copy the full SHA
    93ef7c3 View commit details
  2. chore: update contributors

    jacobheun committed Jan 24, 2019
    Copy the full SHA
    3d8f5cd View commit details
  3. chore: release version v0.12.2

    License: MIT
    Signed-off-by: Jacob Heun <jacobheun@gmail.com>
    jacobheun committed Jan 24, 2019
    Copy the full SHA
    18885e9 View commit details

Commits on Apr 15, 2019

  1. chore: add discourse badge (#83)

    vasco-santos authored and jacobheun committed Apr 15, 2019
    Copy the full SHA
    83475bd View commit details

Commits on Apr 24, 2019

  1. chore: enable ip6 tests (#85)

    vasco-santos authored and jacobheun committed Apr 24, 2019
    Copy the full SHA
    1be100b View commit details

Commits on Jul 22, 2019

  1. chore: update aegir (#87)

    michaelfig authored and jacobheun committed Jul 22, 2019
    Copy the full SHA
    ff19e81 View commit details

Commits on Aug 21, 2019

  1. chore: update multiaddr-to-uri (#89)

    License: MIT
    Signed-off-by: Marcin Rataj <lidel@lidel.org>
    lidel authored and jacobheun committed Aug 21, 2019
    Copy the full SHA
    ee2dcb3 View commit details
  2. chore: update contributors

    jacobheun committed Aug 21, 2019
    Copy the full SHA
    d65c954 View commit details
  3. chore: release version v0.12.3

    License: MIT
    Signed-off-by: Jacob Heun <jacobheun@gmail.com>
    jacobheun committed Aug 21, 2019
    Copy the full SHA
    5a9434b View commit details

Commits on Sep 30, 2019

  1. refactor: async with multiaddr conn (#92)

    BREAKING CHANGE: Switch to using async/await and async iterators. The transport and connection interfaces have changed. See the README for new usage.
    vasco-santos authored and jacobheun committed Sep 30, 2019
    Copy the full SHA
    ce7bf4f View commit details
  2. 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
    jacobheun authored Sep 30, 2019
    Copy the full SHA
    fcb6bcc View commit details
  3. chore: update contributors

    jacobheun committed Sep 30, 2019
    Copy the full SHA
    b0ffbb2 View commit details
  4. chore: release version v0.13.0

    License: MIT
    Signed-off-by: Jacob Heun <jacobheun@gmail.com>
    jacobheun committed Sep 30, 2019
    Copy the full SHA
    b5496fb View commit details
Showing with 755 additions and 599 deletions.
  1. +10 −6 .aegir.js
  2. +3 −40 .gitignore
  3. +0 −35 .npmignore
  4. +44 −28 .travis.yml
  5. +56 −0 CHANGELOG.md
  6. +35 −2 README.md
  7. +0 −29 appveyor.yml
  8. +0 −2 ci/Jenkinsfile
  9. +0 −15 circle.yml
  10. +37 −20 package.json
  11. +8 −0 src/constants.js
  12. +101 −34 src/index.js
  13. +5 −0 src/listener.browser.js
  14. +44 −26 src/listener.js
  15. +0 −37 src/ma-to-url.js
  16. +61 −0 src/socket-to-conn.js
  17. +35 −42 test/browser.js
  18. +47 −8 test/compliance.node.js
  19. +13 −0 test/fixtures/certificate.pem
  20. +15 −0 test/fixtures/key.pem
  21. +241 −275 test/node.js
16 changes: 10 additions & 6 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
'use strict'

const multiaddr = require('multiaddr')
const pull = require('pull-stream')

const pipe = require('it-pipe')
const WS = require('./src')

const mockUpgrader = {
upgradeInbound: maConn => maConn,
upgradeOutbound: maConn => maConn
}
let listener

function boot (done) {
const ws = new WS()
const ws = new WS({ upgrader: mockUpgrader })
const ma = multiaddr('/ip4/127.0.0.1/tcp/9095/ws')
listener = ws.createListener((conn) => pull(conn, conn))
listener.listen(ma, done)
listener = ws.createListener(conn => pipe(conn, conn))
listener.listen(ma).then(() => done()).catch(done)
listener.on('error', console.error)
}

function shutdown (done) {
listener.close(done)
listener.close().then(done).catch(done)
}

module.exports = {
43 changes: 3 additions & 40 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,43 +1,6 @@
docs
node_modules
package-lock.json
yarn.lock

# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
node_modules

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# Vim editor swap files
*.swp

.nyc_output
docs
dist

35 changes: 0 additions & 35 deletions .npmignore

This file was deleted.

72 changes: 44 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,48 @@
# Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
sudo: false
language: node_js
cache: npm
sudo: false

matrix:
include:
- node_js: 6
env: CXX=g++-4.8
- node_js: 8
env: CXX=g++-4.8
# - node_js: stable
# env: CXX=g++-4.8

script:
- npm run lint
- npm run test
- npm run coverage
stages:
- check
- test
- cov

node_js:
- '10'
- '12'

os:
- linux
- osx
- windows

before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

after_success:
- npm run coverage-publish

addons:
firefox: 'latest'
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'; fi

script: npx nyc -s npm run test:node -- --bail
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov

jobs:
include:
- stage: check
script:
- npx aegir build --bundlesize
- npx aegir dep-check
- npm run lint

- stage: test
name: chrome
addons:
chrome: stable
script:
- npx aegir test -t browser

- stage: test
name: firefox
addons:
firefox: latest
script:
- npx aegir test -t browser -- --browsers FirefoxHeadless

notifications:
email: false
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,59 @@
<a name="0.13.0"></a>
# [0.13.0](https://github.com/libp2p/js-libp2p-websockets/compare/v0.12.3...v0.13.0) (2019-09-30)


### Code Refactoring

* async with multiaddr conn ([#92](https://github.com/libp2p/js-libp2p-websockets/issues/92)) ([ce7bf4f](https://github.com/libp2p/js-libp2p-websockets/commit/ce7bf4f))


### BREAKING CHANGES

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



<a name="0.12.3"></a>
## [0.12.3](https://github.com/libp2p/js-libp2p-websockets/compare/v0.12.2...v0.12.3) (2019-08-21)



<a name="0.12.2"></a>
## [0.12.2](https://github.com/libp2p/js-libp2p-websockets/compare/v0.12.1...v0.12.2) (2019-01-24)


### Bug Fixes

* ipv6 naming with multiaddr-to-uri package ([#81](https://github.com/libp2p/js-libp2p-websockets/issues/81)) ([93ef7c3](https://github.com/libp2p/js-libp2p-websockets/commit/93ef7c3))



<a name="0.12.1"></a>
## [0.12.1](https://github.com/libp2p/js-libp2p-websockets/compare/v0.12.0...v0.12.1) (2019-01-10)


### Bug Fixes

* reduce bundle size ([68ae2c3](https://github.com/libp2p/js-libp2p-websockets/commit/68ae2c3))



<a name="0.12.0"></a>
# [0.12.0](https://github.com/libp2p/js-libp2p-websockets/compare/v0.11.0...v0.12.0) (2018-04-30)



<a name="0.11.0"></a>
# [0.11.0](https://github.com/libp2p/js-libp2p-websockets/compare/v0.10.5...v0.11.0) (2018-04-05)


### Features

* add class-is module ([#72](https://github.com/libp2p/js-libp2p-websockets/issues/72)) ([f59cf88](https://github.com/libp2p/js-libp2p-websockets/commit/f59cf88))
* Pass options to websocket server ([#66](https://github.com/libp2p/js-libp2p-websockets/issues/66)) ([709989a](https://github.com/libp2p/js-libp2p-websockets/commit/709989a))



<a name="0.10.5"></a>
## [0.10.5](https://github.com/libp2p/js-libp2p-websockets/compare/v0.10.4...v0.10.5) (2018-02-20)

37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io)
[![Coverage Status](https://coveralls.io/repos/github/libp2p/js-libp2p-websockets/badge.svg?branch=master)](https://coveralls.io/github/libp2p/js-libp2p-websockets?branch=master)
[![Travis CI](https://travis-ci.org/libp2p/js-libp2p-websockets.svg?branch=master)](https://travis-ci.org/libp2p/js-libp2p-websockets)
[![Circle CI](https://circleci.com/gh/libp2p/js-libp2p-websockets.svg?style=svg)](https://circleci.com/gh/libp2p/js-libp2p-websockets)
@@ -16,6 +17,10 @@

> JavaScript implementation of the WebSockets module that libp2p uses and that implements the interface-transport interface
## Lead Maintainer

[Jacob Heun](https://github.com/jacobheun)

## Description

`libp2p-websockets` is the WebSockets implementation compatible with libp2p.
@@ -32,8 +37,36 @@

### Example

```
TODO
```js
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
29 changes: 0 additions & 29 deletions appveyor.yml

This file was deleted.

2 changes: 0 additions & 2 deletions ci/Jenkinsfile

This file was deleted.

15 changes: 0 additions & 15 deletions circle.yml

This file was deleted.

Loading