Files: 0b4d6451ce5d4f2f2c503793f5ac1c61b10bc4ac / connect.js
400 bytesRaw
1 | var pull = require('pull-stream') |
2 | var Ws = require('pull-ws-server') |
3 | var Url= require('url') |
4 | |
5 | module.exports = connect |
6 | |
7 | function connect (client, config) { |
8 | var stream = Ws.connect(getUrl(config), config) |
9 | |
10 | pull( |
11 | stream, |
12 | client.createStream(), |
13 | stream |
14 | ) |
15 | |
16 | return client |
17 | } |
18 | |
19 | function getUrl (config) { |
20 | return typeof config.url === 'string' ? |
21 | config.url : Url.format(config.url) |
22 | } |
23 |
Built with git-ssb-web