Socket
Book a DemoInstallSign in
Socket

ssb-ws

Package Overview
Dependencies
Maintainers
10
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssb-ws

websocket & http server for ssb

Source
npmnpm
Version
2.1.1
Version published
Maintainers
10
Created
Source

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

FAQs

Package last updated on 11 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts