TCP cleanup, added basis of web interface

This commit is contained in:
KimLS
2017-01-08 19:00:39 -08:00
parent 08e72bbbdd
commit 124728e0c7
43 changed files with 690 additions and 6442 deletions
+33
View File
@@ -0,0 +1,33 @@
var servertalk = require('./servertalk_client.js');
var fs = require('fs');
var settings = JSON.parse(fs.readFileSync('settings.json', 'utf8'));
var client = new servertalk.client();
client.Init(settings.addr, settings.port, false, 'WebInterface', settings.key);
client.on('connecting', function(){
console.log('Connecting...');
});
client.on('connect', function(){
console.log('Connected...');
this.Send(47, Buffer.from(JSON.stringify({ method: 'IsLocked', params: [], id: '12345' })));
this.Send(47, Buffer.from(JSON.stringify({ method: 'Lock', params: [] })));
this.Send(47, Buffer.from(JSON.stringify({ method: 'IsLocked', params: [], id: '12346' })));
this.Send(47, Buffer.from(JSON.stringify({ method: 'Unlock', params: [] })));
this.Send(47, Buffer.from(JSON.stringify({ method: 'IsLocked', params: [], id: '12347' })));
});
client.on('close', function(){
console.log('Closed');
});
client.on('error', function(err){
console.log(err);
});
client.on('message', function(opcode, packet) {
console.log(Buffer.from(packet).toString('utf8'));
});