JSPM

  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q41776F
  • License Apache-2.0

hyperswarm-dht-relay websocket server with some instrumentation

Package Exports

  • dht-relay-wss
  • dht-relay-wss/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dht-relay-wss) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

DHT-Relay WSS

Websocket server for the Hyperswarm DHT Relay, with some minimal instrumentation (/health and /metrics endpoints).

Note that hyperswarm-dht-relay is still marked as experimental.

Install

npm i -g dht-relay-wss

Usage

Note: can be run as Docker, see here

The global install exposes a script you can run with

dht-relay-wss

By default, the logs are in JSON format. If you would like them to be human-readable, pipe them into pino-pretty (which needs to be installed):

dht-relay-wss | pino-pretty

When deploying, you will typically want to run this behind a https reverse-proxy which terminates the wss (websocket secure) connection.

Endpoints

Listens for websocket connections at /

In addition, has the following http endpoints:

GET /health

Returns a 200 status if healthy, or 503 otherwise.

GET /metrics

Returns metrics in Prometheus format

Options

Options are specified either in a .env file or as environment variables. They include:

  DHT_RELAY_WS_PORT,
  DHT_RELAY_WS_HOST='127.0.0.1',
  DHT_RELAY_DHT_PORT,
  DHT_RELAY_LOG_LEVEL='info',
  DHT_RELAY_S_SHUTDOWN_MARGIN=10