|
2 years ago | |
---|---|---|
test | 2 years ago | |
LICENSE | 2 years ago | |
README.md | 2 years ago | |
index.js | 2 years ago | |
package.json | 2 years ago | |
recieve.js | 2 years ago |
const bc = require('try-udp-broadcast')
const destroy = bc.broadcast(msg, [opts])
Broadcast a message regularly.
destroy
is a function which you can call with no arguments to stop broadcasting.opts
may include:
opts.interval
interval between packets in ms, default 1000opts.port
port to broadcast on.const destroy = bc.receive(callback [opts])
Listen for messages.
destroy
is a function which you can call with no arguments to stop listening.callback
is called whenever a unique message is found. That is, whenever the message or address changes. The message is passed in the callback.opts
may include:
opts.port
port to listen to