Mikronode help

Hi,
I am trying to make a nodejs script base on mikronde . I tried to run the examples but i have a lot of issues.
E.g:
If I run this code

 var api = require('mikronode');

 var connection = new api('192.168.0.1','admin','password');
 connection.connect(function(conn) {

    conn.closeOnDone(true); // All channels need to complete before the connection will close.
    var listenChannel=conn.openChannel();
    listenChannel.write('/interface/listen',function(chan) {
       chan.on('read',function(data) {
          packet=api.parseItems([data])[0];
          console.log('Interface change: '+JSON.stringify(packet));
       });
    });

    var actionChannel=conn.openChannel();
    // These will run synchronsously
    actionChannel.write(['/interface/set','=disabled=yes','=.id=ether1']); // don't care to do anything after it's done.
    actionChannel.write(['/interface/set','=disabled=no','=.id=ether1']); // don't care to do anything after it's done.
    actionChannel.write('/interface/getall',function(chan) {
       chan.on('done',function(data) {
          packets=api.parseItems(data);
          packets.forEach(function(packet) {
              console.log('Interface: '+JSON.stringify(packet));
          });
          listenChannel.close(); // This should call the /cancel command to stop the listen.
       });
    });
    actionChannel.close(); // The above commands will complete before this is closed.
 });

.. i obtain this error :

RangeError: "msecs" argument must be a non-negative finite number
    at Object.exports.enroll (timers.js:302:11)
    at Socket.setTimeout (net.js:327:12)
    at SocketStream.setTimeout (D:\work\node\test-api\node_modules\mikronode\dist\mikronode.js:505:32)
    at new SocketStream (D:\work\node\test-api\node_modules\mikronode\dist\mikronode.js:472:15)
    at MikroNode.connect (D:\work\node\test-api\node_modules\mikronode\dist\mikronode.js:296:30)
    at D:\work\node\test-api\index.js:10:13
    at Layer.handle [as handle_request] (D:\work\node\test-api\node_modules\express\lib\router\layer.js:95:5)
    at next (D:\work\node\test-api\node_modules\express\lib\router\route.js:131:13)
    at Route.dispatch (D:\work\node\test-api\node_modules\express\lib\router\route.js:112:3)
    at Layer.handle [as handle_request] (D:\work\node\test-api\node_modules\express\lib\router\layer.js:95:5)

… I figure out this is happen only when the connection object don’t have a then function like in the next example…

E.g 2:

var MikroNode = require('mikronode');

var device = new MikroNode('192.168.0.1');
device.connect('admin','password').then(function(conn) {
    conn.closeOnDone(true); // All channels need to complete before the connection will close.
    var listenChannel=conn.openChannel();
    listenChannel.write('/interface/listen');

    // Each sentence that comes down goes through this.
    listenChannel.read.subscribe(function(data) {
        var packet=MikroNode.resultsToObj(data);
        console.log('Interface change: '+JSON.stringify(packet));
    });

    var actionChannel=conn.openChannel();
    actionChannel.sync(true);

    // These will run synchronsously
    actionChannel.write('/interface/set',{'disabled':'yes','.id':'ether1'});
    actionChannel.write('/interface/set',{'disabled':'no','.id':'ether1'});
    actionChannel.write('/interface/getall');
    actionChannel.on('done',function(packet) {
        packet.data.forEach(function(data) {
            var packets=MikroNode.resultsToObj(data);
            console.log('Interface: '+JSON.stringify(packet));
        });
        listenChannel.close(); // This should call the /cancel command to stop the listen.
    });
    actionChannel.close(); // The above commands will complete before this is closed.
});

In this code i put console.log() message and the function done is never executed. I observe after chan.write() function the console.log() message is never displayed.
I spent today more then 5 hours trying a lot of combination but without any success.
Thank in advice.
Bogdan

I fugure out what was the problem. The problem was the code must use promises..