Registry / devops / api-websocket-bridge

api-websocket-bridge

JSON →
library1.0.5jsnpmunverified

A Node.js Docker application that polls an API at a configurable interval and distributes changes to connected WebSocket clients via events. Version 1.0.5 is the latest stable release, with no further updates expected. Designed specifically for polling JSON endpoints and emitting only changed fields as WebSocket events, it differs from general-purpose WebSocket libraries by including built-in polling, diffing, and event mapping via a config.json file. Requires SSL certificates for secure WSS and runs exclusively in Docker.

npm install api-websocket-bridge
INSTALL
IMPORT
SIG · API-WEBSOCKET-BRID
A
api-websocket-bridge
devopsjavascriptv1.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WebSocketDriver
No public API — use Docker image from repository
const WebSocketDriver = require('api-websocket-bridge')
Package is a full application, not a library. It is not designed for importing from Node.js code.
WebSocket
Clients use 'ws' library: const WebSocket = require('ws'); const ws = new WebSocket('wss://host:8080');
import WebSocket from 'api-websocket-bridge'
You import 'ws' as a client, not this package. This package runs a server only.

Shows complete setup: config file, Docker build/run, and client-side WebSocket connection.

// Step 1: Create a config/config.json (example) { "certPath": "/app/cert/fullchain.pem", "keyPath": "/app/cert/privkey.pem", "port": 8080, "updateInterval": 5000, "apiUrl": "https://api.example.com/state.json", "events": { "statusChange": { "emitEvent": "statusChange", "params": ["status"] } } } // Step 2: Build the Docker image docker build -t websocket-driver . // Step 3: Run the container docker run -d -p 8080:8080 --name websocket-container \ -v /path/to/cert/fullchain.pem:/app/cert/fullchain.pem \ -v /path/to/cert/privkey.pem:/app/cert/privkey.pem \ -v /path/to/config:/app/config \ websocket-driver // Step 4: Connect from any WebSocket client const WebSocket = require('ws'); const ws = new WebSocket('wss://localhost:8080'); ws.on('message', data => console.log(data));
Debug
Known issues
breakingRequires Docker — not intended for bare-metal Node.js execution.
fix
Install Docker and run via container as documented.
affects: >=1.0.0
gotchaSSL certificates are mandatory; no fallback to unencrypted WS.
fix
Ensure valid fullchain.pem and privkey.pem files are mounted into /app/cert.
affects: >=1.0.0
gotchaOnly emits events when response fields change; no 'state' snapshot on connect.
fix
Implement separate initial fetch if you need the current state on connection.
affects: >=1.0.0
deprecatedNo API versioning; config structure may change in future releases.
fix
Lock to specific version and review changelog before upgrading.
affects: >=1.0.0
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, open '/app/cert/fullchain.pem'
SSL certificate files not mounted into container.
fix
Mount the correct host path: docker run -v /host/path/to/fullchain.pem:/app/cert/fullchain.pem ...
Connection refused when connecting to wss://host:8080
Container port not published or firewall blocking.
fix
Run container with -p 8080:8080 and ensure host firewall allows inbound on port 8080.
events.json: no such file or directory
Mount volume for config directory is missing or path incorrect.
fix
docker run -v /path/to/config:/app/config
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies
wsrequiredWebSocket server implementation
node:fsrequiredRead SSL certificates from file system
node:httpsrequiredMake HTTPS requests to the API
Agent activity
23 hits · last 30 days
node
20
OpenAI (training)
1
Resources
api-websocket-bridge — npm install api-websocket-bridge · libregistry