mirror of
https://github.com/fluencelabs/js-libp2p-websockets
synced 2025-04-24 22:42:25 +00:00
land it
This commit is contained in:
parent
781ffba393
commit
56197e09e5
34
package.json
Normal file
34
package.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "libp2p-websockets",
|
||||
"version": "0.0.0",
|
||||
"description": "JavaScript implementation of the WebSockets module that libp2p uses and that implements the abstract-transport interface ",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"pre-commit": [],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/diasdavid/js-libp2p-websockets.git"
|
||||
},
|
||||
"keywords": [
|
||||
"IPFS"
|
||||
],
|
||||
"author": "David Dias <daviddias@ipfs.io>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/diasdavid/js-libp2p-websockets/issues"
|
||||
},
|
||||
"homepage": "https://github.com/diasdavid/js-libp2p-websockets#readme",
|
||||
"dependencies": {
|
||||
"multiaddr": "^1.1.1",
|
||||
"simple-websocket": "github:diasdavid/simple-websocket#ec31437"
|
||||
},
|
||||
"devDependencies": {
|
||||
"interface-connection": "0.0.3",
|
||||
"interface-transport": "^0.1.1",
|
||||
"pre-commit": "^1.1.1",
|
||||
"standard": "^5.2.2",
|
||||
"tape": "^4.2.0"
|
||||
}
|
||||
}
|
14
src/index.js
Normal file
14
src/index.js
Normal file
@ -0,0 +1,14 @@
|
||||
var SWS = require('simple-websocket')
|
||||
|
||||
exports = module.exports
|
||||
|
||||
exports.dial = function (multiaddr, options) {
|
||||
options.ready = options.ready || function noop () {}
|
||||
var opts = multiaddr.toOptions()
|
||||
var url = 'ws://' + opts.host + ':' + opts.port
|
||||
var socket = new SWS(url)
|
||||
socket.on('connect', options.ready)
|
||||
return socket
|
||||
}
|
||||
|
||||
exports.createListener = SWS.createServer
|
Loading…
x
Reference in New Issue
Block a user