1.3.3 • Published 2 years ago

@mangar2/mqtt v1.3.3

Weekly downloads
9
License
LGPL-3.0-or-later
Repository
github
Last release
2 years ago

Abstract

Creates Mqtt message handler , receives , checks , transforms and foreward messages It supports the callbacks 'send' and 'publish'

Creates Mqtt message handler , receives , checks , transforms and foreward messages It supports the callbacks 'send' and 'publish'

Contents

Meta

Filecheckdefinitions.js
AbstractCreates Mqtt message handler , receives , checks , transforms and foreward messages It supports the callbacks 'send' and 'publish'
AuthorVolker Böhm
CopyrightCopyright ( c ) 2020 Volker Böhm
LicenseThis software is licensed under the GNU LESSER GENERAL PUBLIC LICENSE Version 3 . It is furnished "as is" , without any support , and with no warranty , express or implied , as to its usefulness for any purpose .
Filemqtt.js
AbstractCreates Mqtt message handler , receives , checks , transforms and foreward messages It supports the callbacks 'send' and 'publish'
AuthorVolker Böhm
CopyrightCopyright ( c ) 2020 Volker Böhm
LicenseThis software is licensed under the GNU LESSER GENERAL PUBLIC LICENSE Version 3 . It is furnished "as is" , without any support , and with no warranty , express or implied , as to its usefulness for any purpose .

Type definitions

httpReturn {Object}

Object containing all information to create a http return information | Name | Type | Description | | ---- | ---- | ------- | | headers | Object | header parameters | | | payload | Object | payload data | | | statusCode | number | | |

Callback definitions

sendCallback

sendCallback Parameters

NameTypeDescription
hoststringhost name
portnumber, stringnumber
pathstringhttp path for sending data
payloadObjectpayload ( body ) to send
headersObjectheaders to send

publishCallback

publishCallback Parameters

NameTypeDescription
messageMessagemessage published

Class Mqtt

new Mqtt(configuration)

Creates Mqtt message handler . It supports the callbacks 'send' and 'publish'

Mqtt Parameters

NameTypeDescription
configurationObjectconfiguration options for the instance

configuration properties

NameTypeDescription
logObjectlogging options
fileNamestringfilename for persistence
directorystringdirectory ( file path ) for persistence
replyTimeoutInMillisecondsnumbertimeout to wait for an answer of a http call , default 10 seconds
inFlightWindownumberamount of qos 1 and qos 2 messages send for the same topic at the same time , default 1
pubrelTimeoutInMillisecondsnumbertimout to wait for a corresponding pubrel message , default one day
maxRetryCountnumberamount of resend of messages before forcing a disconnect
maxQueuSizenumbermaximal amount of entries in a message queue

Mqtt Methods

_publishLogMessage

_publishLogMessage (service, value, clientId)

Publishes a log - message

_publishLogMessage Parameters
NameTypeDescription
servicestringname of the service bringing the message
valuestringvalue of the log message
clientIdstringname of the client involved

getConnections

getConnections (clientId) => {httpReturn}

Gets all connections or a single connection ( depends on path )

getConnections Parameters
NameTypeDescription
clientIdstringid of the client or ""
getConnections returns
TypeDescription
httpReturnhttp return information

on

on (event, callback)

Sets a callback .

on Parameters
NameTypeDescription
event'send', 'publish'callback name
callbacksendCallback, publishCallbackthe callback for send and publish
on throws
TypeDescription
Errorif the event is not supported
Errorif the callback is not 'function'

processRequest

processRequest (controls, payload, headers) => {httpReturn}

Calls a connection interface

processRequest Parameters
NameTypeDescription
controlsstringname of the mqtt controls to call ( connect , disconnect , . . . )
payloadObjectparameters for the interface ( see interfaces )
headersObjectheaders of the http message
processRequest returns
TypeDescription
httpReturnhttp return information

processSendMessage

async processSendMessage () => {number}

Processes all messages to send and for each message calls the provided callback functions registered by calls to 'on' : 'send' ( host , port , action , payload , headers )

processSendMessage returns
TypeDescription
numberamount of messages sent

restoreFromFile

restoreFromFile ()

Restores the broker state from a file

1.3.3

2 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

5 years ago

1.0.0

5 years ago