Namespace: mikronode

mikronode

MikroNode

Classes

Channel
Connection
Trap
TrapError

Methods

staticmikronode.getConnection(host, user, password, options)

Creates or returns a Connection object.

Name Type Description
host string

The host name or ip address

user string

The user name

password string

The users password

options object optional
Name Type Default Description
port number 8728 optional

Sets the port if not the standard 8728 (8729 for
TLS).

closeOnDone boolean false optional

If set, when the last channel closes,
the connection will automatically close.

timeout number 0 optional

Sets the socket inactivity timeout. A timeout
does not necessarily mean that an error has occurred, especially if you're
only listening for events.

closeOnTimeout boolean false optional

If set, when a socket timeout happens
the connection will automatically close.

tls object | boolean optional

Set to true to use TLS for this connection.
Set to an object to use TLS and pass the object to tls.connect as the tls
options. If your device uses self-signed certificates, you'll either have to
set 'rejectUnauthorized : false' or supply the proper CA certificate. See the
options for
tls.connect()
for more info.

Fires:
Throws:

WARNING: If you do not listen for 'error' or 'timeout' events and one
occurrs during the initial connection (host unreachable, connection refused,
etc.), an "Unhandled 'error' event" exception will be thrown.

Example
var MikroNode = require('mikronode');

var connection = MikroNode.getConnection('192.168.88.1', 'admin', 'mypassword', {
    timeout : 4,
    closeOnDone : true,
    closeOnTimeout : true,
});

connection.on('error', function(err) {
    console.error('Error: ', err);
});

staticmikronode.parseItems(data){Array.<object>}

Parse !re return records into an array of objects

Name Type Description
data Array.<string>

The data[] returned from Channel.on('done')

Returns:
Array of objects