Teonet client node.js module used in generator-teonet-client, generator-teonet-client-webkit to connect node.js client applications with Teonet.
npm install teonet-client
sudo apt-get install build-essential
npm link teonet-client
-
Export module teonetClient = require('teonet-client');
-
initialize teonetClient.init();
-
Establish a connection var connector = teonetClient.connectAsync( host_id, // host ip port, // port function(object, error_code) {// select-like method .................... }, function(error_code) { // Connection lost .................... } )
where: error_code is a code of last operartion ( 0 - success otherwise errno ) object: obj.event - event id obj.peer_name - peer name obj.cmd - cmd ??? obj.buffer - binary buffer