UNPKG

657 BMarkdownView Raw
1# ssb-ws
2
3ssb-ws & http server for ssb.
4
5Work In Progress
6
7``` js
8sbot plugins.install ssb-ws
9```
10
11make sure you set a port in your config file (~/.ssb/config).
12
13``` json
14{
15 "ws": {"port": 8989}
16}
17```
18
19## adding your own http handlers
20
21sometimes you need to do http, here is an example sbot plugin that
22exposes the websocket address.
23
24``` js
25require('scuttlebot')
26 .use(require('ssb-ws'))
27 .use({
28 name: 'test123',
29 version: '1.0.0',
30 init: function (sbot) {
31 sbot.ws.use(function (req, res, next) {
32 if(req.url == '/get-address')
33 res.end(sbot.ws.getAddress())
34 else next()
35 })
36 }
37 })
38```
39
40## License
41
42MIT
43