mirror of
https://github.com/fluencelabs/js-libp2p-websockets
synced 2025-06-20 14:46:42 +00:00
land it
This commit is contained in:
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
|
Reference in New Issue
Block a user