iopsys-ws-communicator
v1.0.29
Published
Helper library for openWrt ubus communication over WebSocket using RPC. Can be uses together with [OpenWrt WebSocket Daemon (OWSD)](https://dev.iopsys.eu/iopsys/owsd).
Downloads
35
Readme
iopsys-ws-communicator
Helper library for openWrt ubus communication over WebSocket using RPC. Can be uses together with OpenWrt WebSocket Daemon (OWSD).
Installation
npm install iopsys-ws-communicator
Usage
const { connect, get, resolveReferences, disconnect } = require('iopsys-ws-communicator');
const IP = '192.168.1.1';
const PORT = 80;
const USERNAME = 'user';
const PASS = 'user';
const run = async () => {
// Connect to device
const session = await connect(IP, PORT, USERNAME, PASS);
// Get property
await get('Device.WiFi.', session).then(console.log);
// Get resolved property
await get('Device.Hosts.', session).then(msg => resolveReferences(msg, session)).then(console.log);
// Disconnect
await disconnect(session);
};
run();