axia-socket v1.0.10
Installation
npm install --save axia-socket
Basic Usage
const axiaSocket = require("axia-socket");
let newSocket = new axiaSocket({
host : "127.0.0.1",
port : "8000",
reconnect : 5000,
pollInterval : 200
});
host is the IP address of the LiveWire device you want to connect to. Default is localhost.
port is the LiveWire telnet port of the device. Default is port 93.
reconnect indicates the how long it will wait until it reconnects after a connection error. Default is 5000 milliseconds
pollInterval indicates how often this sends the list of polls to the device. Default is 1000 milliseconds.
Methods
write(command)
Send a command to device.
run
Start polling. This gets called automatically after object is initialized.
stop
Stop polling. Emits halt event.
addCommand(command)
Adds a command to poll. Added commands will be sent to the device continuously on every interval set in runSpeed. This emits a log event.
removeCommand(command)
Removes a command from poll. This emits a log event.
Events
connected
On successful connection to device.
run
On poll run.
halt
On poll stop.
log
Internal logged messages.
data.raw
On data receive, returning raw chunk of data.
error.raw
On error, returning raw error.