UDP based broadcasting and receiving module, It expects an JS Object and returns the same on the otherside
$ npm install upd-radio
const Radio = require('udp-radio');
const BROADCAST_ADDR = "127.0.0.1";
const BROADCAST_PORT = 9999
let channel_0 = new Radio(BROADCAST_ADDR, BROADCAST_PORT, (message, info)=>{
// on receiving of a radio broadcast
console.log(message);
})
const message = {
_type: "LOGOUT",
_content: os.hostname();
}
channel_0.broadcast(message);
channel_0.close();