Skip to content
/ udp-radio Public

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

License

Notifications You must be signed in to change notification settings

pwmb/udp-radio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published