Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

ssb-ws

2.1.1 • Public • Published

ssb-ws

ssb-ws & http server for ssb.

Work In Progress

sbot plugins.install ssb-ws

make sure you set a port in your config file (~/.ssb/config).

{
  "ws": {"port": 8989}
}

adding your own http handlers

sometimes you need to do http, here is an example sbot plugin that exposes the websocket address.

require('scuttlebot')
  .use(require('ssb-ws'))
  .use({
    name: 'test123',
    version: '1.0.0',
    init: function (sbot) {
      sbot.ws.use(function (req, res, next) {
        if(req.url == '/get-address')
          res.end(sbot.ws.getAddress())
        else next()
      })
    }
  })

License

MIT

Keywords

none

install

npm i ssb-ws

Downloadsweekly downloads

158

version

2.1.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar