![smoke-signal-js logo](https://raw.githubusercontent.com/Smoke3785/smoke-signal-js/main/docs/smokeSignal.png?token=GHSAT0AAAAAABT2Z44Z466E3WDWUICWF3C4YUGSZTQ) # smoke-signal-js A JavaScript port of Tobster's communication library, TobComm. Be aware - this implementation is functional, not class-based! This is because I am not Bri\*ish. # Installation `npm install smoke-signal-js` # Usage ```js // For ES6 imports import { smokeSignal } from 'smoke-signal-js'; // For commonJS const { smokeSignal } = require('smoke-signal-js'); ``` # Documentation [GitHub](https://github.com/Smoke3785/smoke-signal-js) **|** [NPM](https://www.npmjs.com/package/smoke-signal-js) **|** [View on Website](https://owenrossikeen.com/docs/smoke-signal-js) **|** [Donate](https://owenrossikeen.com/donate) ## Functions
getSendObjectData({)bytebuffer

Encodes an object into a Tobject ( a bytebuffer prepended with metadata) to send data to a LaunchLike server.

getSendCommandData({lCommand,)bytebuffer

Encodes data required to send a command to a LaunchLike server.

getRequestObjectData({lObject,)bytebuffer

Encodes data required to make an object request to a LaunchLike server.

sendCommand({lObject,)

Requests a command from a LaunchLike server with the given code.

sendObject({lObject,)

Sends an object from a LaunchLike server with the given code and data.

requestObject({cData})

Requests an object from a LaunchLike server with the given code.

processBytes(cData, context)

Takes a Tobject and parses out a message type definition and length for the data. The function then calls a handler method of the context which was provided to it with the transcribed data.

## getSendObjectData({) ⇒ bytebuffer Encodes an object into a Tobject ( a bytebuffer prepended with metadata) to send data to a LaunchLike server. **Kind**: global function | Param | Type | Description | | ----- | ------------------- | ----------------------------------------- | | { | object | lObject, lInstanceNumber, lStart, cData } | ## getSendCommandData({lCommand,) ⇒ bytebuffer Encodes data required to send a command to a LaunchLike server. **Kind**: global function | Param | Type | Description | | ---------- | ------------------- | ---------------- | | {lCommand, | object | lInstanceNumber} | ## getRequestObjectData({lObject,) ⇒ bytebuffer Encodes data required to make an object request to a LaunchLike server. **Kind**: global function | Param | Type | Description | | --------- | ------------------- | --------------------------------- | | {lObject, | object | lInstanceNumber, lStart, lLength} | ## sendCommand({lObject,) ⇒ Requests a command from a LaunchLike server with the given code. **Kind**: global function **Returns**: Nothing. This calls a function within the class context provided to it. | Param | Type | Description | | --------- | ------------------- | ---------------- | | {lObject, | object | lInstanceNumber} | ## sendObject({lObject,) ⇒ Sends an object from a LaunchLike server with the given code and data. **Kind**: global function **Returns**: Nothing. This calls a function within the class context provided to it. | Param | Type | Description | | --------- | ------------------- | ------------------------------- | | {lObject, | object | lInstanceNumber, lStart, cData} | ## requestObject({cData}) ⇒ Requests an object from a LaunchLike server with the given code. **Kind**: global function **Returns**: Nothing. This calls a function within the class context provided to it. | Param | Type | Description | | ------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | | {cData} | object | An object containing the request code, the instance number, the starting position, and the length. Generally only the data is provided. | ## processBytes(cData, context) ⇒ Takes a Tobject and parses out a message type definition and length for the data. The function then calls a handler method of the context which was provided to it with the transcribed data. **Kind**: global function **Returns**: Nothing. This calls a function within the class context provided to it. | Param | Type | Description | | ------- | ----------------------- | ---------------------------------------------------------- | | cData | bytebuffer | The data which you wish to decode | | context | class | The class context from which you're calling this function. | # Dependencies - [bytebuffer.js](https://www.npmjs.com/package/bytebuffer) - [smoke-machine-js](https://www.npmjs.com/package/smoke-machine-js) Huge shout-out to bytebuffer.js. This package powers several of my projects and is phenomenal. The developer of smoke-machine-js is remarkably handsome.