1.0.0 • Published 4 years ago

buffer-broadcaster v1.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

buffer-broadcaster

Websocket client for compressing and then broadcasting large buffers.

Install

npm i buffer-broadcaster

Usage

For using the library, you must create a broadcaster using the launchBroadcaster method, as such:

const bp = require('buffer-broadcaster')
const port = 7000 // port through where the sockets will be emited

const broadcaster = bp.launchBroadcaster(port)

Once you've done that, you have on hold a new empity Buffer. As you gather your data, you can append it just like that:

broadcaster.appendBuffer(dataBuffer)

After you have all the data you need to transmit, you broadcast it, cleaning the buffer on hold.

broadcaster.broadcast()