This is a broad question, but I will give you some tips.
A nice example is LogIo . After you want to run some commands and then press the output in the GUI, using Node.js will become a natural approach. This application may contain several elements:
- part one, which runs the commands and collects the output and clicks on
- part two, which receives the output and saves it in DB / files. After saving, this part passes the event to
- part three, it should be a websocket server that will handle users on the network and distribute events to
- , , websocket , , GUI.
, PHP, python, PHP ( db), , , UDP UDP .
python script, . , grep:
tail -f /var/log/apache2/access.log | /usr/share/bin/myharvester
- myharvester.
, , , Node.js cript . script . :
var config = {};
var app = require('http').createServer().listen(config.server.port);
var io = require('socket.io').listen(app);
var listenerDgram = require('dgram').createSocket('udp4');
listenerDgram.bind(config.listeners.udp.port);
var sprintf = require('sprintf').sprintf;
var users = [];
app.on('error', function(er) {
console.log(sprintf('[%s] [ERROR] HTTP Server at port %s has thrown %s', Date(), config.server.port, er.toString()));
process.exit();
});
listenerDgram.on('error', function(er) {
console.log(sprintf('[%s] [ERROR] UDP Listener at port %s has thrown %s', Date(), config.listeners.udp.port, er.toString()));
process.exit();
});
listenerDgram.on('message', function(msg, rinfo) {
if(user) {
users[user].emit('notification', frame);
} else {
io.emit('notification', frame);
}
});
io.sockets.on('connection', function(socket) {
});
, . script UDP , websockets. , Node.js, , , UDP , script, websocket , back-end CRM.
() , - JavaScript , .
, , Call-Center , . , ( CRM) - CRM API ( ) Asterisk Node.js .