JSPM

udp-messenger

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q32520F
  • License ISC

Send messages over udp in small chunks

Package Exports

  • udp-messenger

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (udp-messenger) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

#UDP Messenger This is a library to send messages over udp. Messages are broken into chunks and reorganized on the other side. There is a loose detection of failures and messages will attempt to resend themselves upon failure.

const Messenger = require('udp-messenger')

let messenger = new Messenger(2000, 54000, 512) // timeout, port, packet size (must be greater than 32 bytes)
messenger.on('message', (msg)=>{}) // when a message is received
messenger.on('listening', ()=>{}) //when a messenger begins listening
messenger.on('error', (err)=>{}) // when an error occurs
messenger.on('sent', (msg)=>{}) // when a message is sent
messenger.on('failure', (msg)=>{}) // when a failure to receive a message occurs
messenger.on('dropped', (msg)=>{}) // when a message cannot be resent
messenger.listen()// start listening for messages
messenger.send(new Buffer("Hello World!") , '192.168.1.3', 52000) //send a message (buffer, host, port)
messenger.close(()=>{}) // stop listening

##license ISC