1
0
mirror of https://github.com/fluencelabs/js-libp2p-websockets synced 2025-03-31 22:51:11 +00:00

29 lines
469 B
JavaScript
Raw Normal View History

'use strict'
2017-10-20 11:25:14 +01:00
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)
}
2017-10-20 11:25:14 +01:00
module.exports = {
hooks: {
browser: {
pre: boot,
post: shutdown
2017-10-20 11:25:14 +01:00
}
}
}