mirror of
https://github.com/fluencelabs/js-libp2p-websockets
synced 2025-03-28 03:41:11 +00:00
* feat: dns support for WS * fix: address parsing * feat: filter IPFS addrs correctly * fix: remove lodash includes dependency * feat: mafmt addrs now support /ipfs no need for ad-hoc filtering * feat: skip p2p-circuit addresses * chore: updating ci files * chore: upgrading to new aegir * test: pass the no-parallel flag to tests * wip * test: removing global timeout and setting it on a specific test * feat: resolve 0 addresses (#64) * feat: resolve 0 addresses * chore: upgrading pull-ws * chore: update circle CI * chore: update gitignore * chore: update deps * chore: update CI again * test: fix node.js tests * test: fix browser tests * chore
29 lines
469 B
JavaScript
29 lines
469 B
JavaScript
'use strict'
|
|
|
|
const multiaddr = require('multiaddr')
|
|
const pull = require('pull-stream')
|
|
|
|
const WS = require('./src')
|
|
|
|
let listener
|
|
|
|
function boot (done) {
|
|
const ws = new WS()
|
|
const ma = multiaddr('/ip4/127.0.0.1/tcp/9095/ws')
|
|
listener = ws.createListener((conn) => pull(conn, conn))
|
|
listener.listen(ma, done)
|
|
}
|
|
|
|
function shutdown (done) {
|
|
listener.close(done)
|
|
}
|
|
|
|
module.exports = {
|
|
hooks: {
|
|
browser: {
|
|
pre: boot,
|
|
post: shutdown
|
|
}
|
|
}
|
|
}
|