Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rsksmart/rif-communications-pubsub-bootnode

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rsksmart/rif-communications-pubsub-bootnode

Simple bootnode for RIF Communications PubSub

  • 0.1.0-dev.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

RIF Communications PubSub bootnode

CircleCI Dependency Status standard-readme compliant js-standard-style Managed by tAsEgir

Simple boot node for RIF Communications PubSub

The aim to provide a libp2p node which serves as bootstrap node for projects which use rif-commmunications-pubsub.

This can be also used for local development where you can define the list of Rooms that will be listened on and messages printed out to STDOUT.

Table of Contents

Usage

Example of usage:

npm start

Spawns a new libp2p node with new PeerId listening to TCP connections on port 6030.

NODE_ENV=develop npm start

Spawns a new libp2p node with PeerId QmbQJ4FyVBAar7rLwc1jjeJ6Nba6w2ddqczamJL6vTDrwm listening to websocket connections on port 6030 and joins rooms 0xtestroom and 0xtestroom2. Any peers joining and leaving the room will be logged as well as any messages in th following format:

<roomName>: peer <peerId> joined
<roomName>: peer <peerId> left
<roomName>: message {from: <peerId>, data: <content of the message>}
<roomName>: message {from: <peerId>, data: <content of the message>, to: <peerId>} // Only for direct messages

Config

In ./config. You can switch between configurations by setting NODE_ENV variable. Local configuration is good to put to local.json5 file. For configuration mechanism please visit the node-config page.

// Libp2p config
libp2p: {},

// Peer ID in a JSON format
peerId: {},

// Rooms to subscribe to, strings
rooms: []

Supported env. variables

  • RIFC_ROOMS (json/array): same as rooms option
  • RIFC_LISTEN_ADDR (json/array): same as libp2p.address.listen
  • RIFC_PEER_ID (json): Peer ID JSON like specified in `js-peer-id

Deployment

This project can be deployed with Dockerfile bundled with this repo. Ports 6666 and 6667 have to be published. Also if this is deployed on production level stable PeerId should be used. If PeerId is not defined than over restarts it will change, which should not happen for production boot nodes.

You can generate one using npm run generate-peerid and then set that either with config file or RIFC_PEER_ID env. variable (set the variable as the whole generated JSON).

$ PEER_ID=$(npm run generate-peerid) // This should be stored in some file somewhere
$ docker build -t rif-comunication-bootnode .  
$ docker run -e RIFC_PEER_ID="$PEER_ID" -p 6666 -p 6667 -it rif-comunication-bootnode  

License

MIT

Keywords

FAQs

Package last updated on 13 Nov 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc