Registry / devops / iopsys-ws-communicator

iopsys-ws-communicator

JSON →
library1.0.29jsnpmunverified

Helper library for OpenWrt ubus communication over WebSocket using RPC. Designed to work with OpenWrt WebSocket Daemon (OWSD). Version 1.0.29. Provides a simple API (connect, get, resolveReferences, disconnect) for interacting with ubus objects on OpenWrt devices. Similar to direct ubus usage but over WebSocket. Supports USP data models (TR-181).

npm install iopsys-ws-communicator
INSTALL
IMPORT
SIG · IOPSYS-WS-COMMUNIC
I
iopsys-ws-communicator
devopsjavascriptv1.0.29
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.

connect
const { connect } = require('iopsys-ws-communicator')
import { connect } from 'iopsys-ws-communicator'
Package is CJS only; ESM import may not work without bundler.
get
const { get } = require('iopsys-ws-communicator')
resolveReferences
const { resolveReferences } = require('iopsys-ws-communicator')
disconnect
const { disconnect } = require('iopsys-ws-communicator')

Demonstrates connecting to an OpenWrt device over WebSocket, fetching a ubus object, resolving references, and disconnecting.

const { connect, get, resolveReferences, disconnect } = require('iopsys-ws-communicator'); const IP = '192.168.1.1'; const PORT = 80; const USERNAME = 'user'; const PASS = 'user'; async function run() { const session = await connect(IP, PORT, USERNAME, PASS); try { const data = await get('Device.WiFi.', session); console.log(data); const resolved = await resolveReferences(data, session); console.log(resolved); } finally { await disconnect(session); } } run().catch(console.error);
Debug
Known issues
gotchaSession must be passed to each function call. Forgetting to pass the session parameter will result in errors.
fix
Always pass the session object returned by connect() to get(), resolveReferences(), and disconnect().
affects: >=1.0.0
gotchaPackage uses WebSocket and may fail if the target device does not have OWSD running or WebSocket port is blocked.
fix
Ensure OWSD is installed and running on the device; verify network/firewall allows WebSocket connections.
affects: >=1.0.0
gotcharesolveReferences may cause infinite loops if references form a cycle or if the data contains circular references.
fix
Monitor recursion depth; consider adding a timeout or limiting reference resolution.
affects: >=1.0.0
gotchaError handling: connect() rejects if credentials are wrong or connection fails; always wrap in try/catch.
fix
Use try/catch around async calls; check error message for authentication failure or timeout.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'get')
Session object is undefined or not passed correctly.
fix
Ensure connect() returned a valid session object and that you pass it to get() as second argument.
Error: connection timeout
WebSocket connection to the device timed out.
fix
Verify IP, PORT, and that OWSD is running. Increase timeout if necessary (not library configurable).
Error: authentication failed
Incorrect username/password for the device.
fix
Provide valid credentials. Note that credentials may be for the device's web interface (ubus).
Upgrade
Version history
1.0.29latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
10
Resources
iopsys-ws-communicator — npm install iopsys-ws-communicator · libregistry