This project exposes a lightweight WebSocket bridge that receives raw JSON payloads and republishes them to a configured Streamr stream. It is designed to run alongside a producer process that pushes telemetry or metrics over a local WebSocket connection.
- Node.js 18+ (Node 20 recommended) and npm, or Docker 24+ with Docker Compose.
- A Streamr private key with publish permissions to your target stream.
- Copy the sample environment file:
cp client/.env.sample client/.env - Edit
client/.envand provide either:STREAMR_ETH_ACCOUNTandSTREAM_ID, which will be combined as<account>/<stream>; orSTREAMR_STREAM_IDwith the full stream identifier.
- Optional configuration:
WEBSOCKET_PORT(default8080) controls the inbound WebSocket listener.LOG_LEVEL(defaultinfo) controls the pino logger verbosity.
cd client
npm install
npm startThe bridge listens on ws://localhost:8080 by default. Connect with any WebSocket client and send JSON payloads; successful publishes return {"status":"ok"}. Invalid JSON or publish failures respond with an error message and are logged.
docker compose build
WEBSOCKET_PORT=8080 docker compose upCompose reads environment values from client/.env for Streamr credentials. Export or set WEBSOCKET_PORT before docker compose up if you need a non-default port. The container maps the chosen port on both the host and container.
Unit tests cover the message handling logic that validates payloads, publishes to Streamr, and returns acknowledgements.
cd client
npm testLogs are emitted through pino and include connection identifiers, client addresses, and error details to make traceability straightforward in production environments.