1.2.0 • Published 6 years ago

xgmp v1.2.0

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

xGraph Message Parser

xgmp is an implementation of the core communication method between xgraph systems.

Example:

const {StreamParser} = require('xgmp');

// constructor works with any nodejs Stream object, with
// a data event.
let protocolAdapter = new StreamParser({read:process.stdin});

protocolAdapter.on('reply', ({err,cmd}) => {
	if (err) console.log(err);
	else console.dir("reply >>", cmd);
});

protocolAdapter.on('ping', (cmd) => {
	console.dir("ping >>", cmd);
});

protocolAdapter.on('query', (cmd) => {
	console.dir("query >>", cmd);
});

protocolAdapter.on('error' , (errorObject) =>{
	console.dir("error >>", errorObject);
});

Example:

const {StreamParser} = require('xgmp');

// constructor works with any nodejs Stream object, with
// a data event.
let protocolAdapter = new StreamParser({write:process.stdout});

protocolAdapter.ping({Cmd:"PingTEST"});
protocolAdapter.query({Cmd:"QueryTEST"});
protocolAdapter.reply("",{Cmd:"ReplyTEST"});
protocolAdapter.reply(null,{Cmd:"ReplyTEST"});
protocolAdapter.reply(false,{Cmd:"ReplyTEST"});
protocolAdapter.reply("Broken",{Cmd:"ReplyTEST"});
1.2.0

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago