lwes-emitter

Emitting UDP packet for LWES

LWES-emitter

Module for emitting UDP packets for Light Weight Event System.
No dependencies or calling external C libraries, just using Node.js.

emit = require('./lwes.js');

var config = {
  port: 12345, 
  host: '127.0.0.1'
};

// "name": "YP::Mon::Perf",
// "RequesterIP": "127.0.0.1",

var meta = {
 "aid": "push-service",
 "avid": "0.1",
 "eid": "where do i get the event id",
 "inreq": "/register",
 "method": "POST /register",
 "rid": "where do i get request id",
 "enc": "1",
 "code": "200",
 "rt_total": "89"
};

var data = {
  "name1": "myService", 
  "req1": "myservice.foo.com/registration", 
   "code1": "201",
   "resp1": "{}",
   "rt1": "250"
};

// config, event description and data
emit(config, "performance-event", meta, data);

To listen, install the LWES C library on your machine and run:

lwes-event-printing-listener -m 127.0.0.1

You should see this output:

performance-event[8]
{
  SenderPort = 58429;
  name1 = myService;
  rt1 = 250;
  code1 = 201;
  ReceiptTime = 1359863273745;
  SenderIP = 127.0.0.1;
  req1 = myservice.foo.com/registration;
  resp1 = {};
}