const webTCPServer = "127.0.0.1";
const webTCPPort = 9999;
const socketServer = "127.0.0.1";
const socketPort = 12052;

var net = new WebTCP(webTCPServer, webTCPPort);
// standard socket options
options = {
encoding: "binary",
timeout: 0,
noDelay: true, // disable/enable Nagle algorithm
keepAlive: true, //default is false
initialDelay: 0 // for keepAlive. default is 0
}
// Create a socket. specify host and port of TCP server here
var socket = net.createSocket(socketServer, socketPort, options);

// On connection callback
socket.on('connect', function () {
    console.log('connected');
});


util = {
    getMonthlyInstallations:function(callback)
    {
        var devicedata ={};        
        devicedata.action= "GETMONTHLYINSTALLS";
        var msg = JSON.stringify(devicedata);
        console.log(msg);
        socket.write(msg);
        socket.on('data', function (data) {
            callback(data);            
        });
    }    
}