udp-radio

1.2.0 • Public • Published

udp-radio

UDP based broadcasting and receiving module, It expects an JS Object and returns the same on the otherside

Instalation

$ npm install upd-radio

Usages

Requiring the package

const Radio = require('udp-radio');

Async receiving any broadcast

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);
})

Async send any broadcast

const message = {
  _type: "LOGOUT",
  _content: os.hostname();
}
channel_0.broadcast(message);
channel_0.close();

Package Sidebar

Install

npm i udp-radio

Weekly Downloads

1

Version

1.2.0

License

MIT

Unpacked Size

5.15 kB

Total Files

7

Last publish

Collaborators

  • soumesh.banerjee