@mangar2/mqttversion
v1.2.2
Published
implements interface adapter version
Readme
Abstract
Contents
Meta
Global functions
connect
connect (version, options) => {Object}
Creates the objects to connect ot a broker
connect Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| version | string | interface version '1 . 0' or '0 . 0' | |
| options | Object | connect options | |
options properties
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| clientId | string | unique client identifier | |
| host | string | host name of the client host | |
| port | number | port number of the clien listening port | |
| clean | bool | true , if the connection is cleaned up after disconnect | |
| keepAlive | nubmer | keep alive time in milliseconds | |
connect returns
| Type | Description |
| ---- | ----------- |
| Object | { headers , payload , resultCheck ( result ) } |
disconnect
disconnect (clientId) => {Object}
Creates the objects to disconnect from a broker
disconnect Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| clientId | string | unique client identifier | |
disconnect returns
| Type | Description |
| ---- | ----------- |
| Object | { headers , payload , resultCheck ( result ) } |
onConnect
onConnect (headers, payload) => {Object}
Creates the return types for a connect request
onConnect Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| headers | Object | message headers | |
| payload | Object | payload to return | |
onConnect returns
| Type | Description |
| ---- | ----------- |
| Object | { headers , payload , statusCode } |
onDisconnect
onDisconnect (headers) => {Object}
creates the return types for a disconnect request
onDisconnect Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| headers | Object | message headers | |
onDisconnect returns
| Type | Description |
| ---- | ----------- |
| Object | { headers , payload , statusCode } |
onPublish
onPublish (headers) => {Object}
creates the return types for a receive message
onPublish Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| headers | Object | input headers | |
onPublish returns
| Type | Description |
| ---- | ----------- |
| Object | { headers , payload , statusCode , packetid } |
onPubrel
onPubrel (headers) => {Object}
Creates the objects for a qos = 2 commit message "pubcomp"
onPubrel Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| headers | Object | pubrel message headers | |
onPubrel returns
| Type | Description |
| ---- | ----------- |
| Object | { headers , payload , statusCode , packetid } |
onSubscribe
onSubscribe (headers, qosArray) => {Object}
Creates the subscribe result objects
onSubscribe Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| headers | Object | input headers | |
| qosArray | Array | quality of service reply array | |
onSubscribe returns
| Type | Description |
| ---- | ----------- |
| Object | { headers , payload , statusCode , packetid } |
onUnsubscribe
onUnsubscribe (headers) => {Object}
creates the return types for a disconnect request
onUnsubscribe Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| headers | Object | message headers | |
onUnsubscribe returns
| Type | Description |
| ---- | ----------- |
| Object | { headers , payload , statusCode , packetid } |
publish
publish (version, token, message, qos, dup, retain, packetid) => {Object}
Creates the objects to publish to a client
publish Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| version | string | interface version ( '0 . 0' or '1 . 0' ) | |
| token | string | connection token | |
| message | Object | payload | |
| qos | number | quality of service ( 0 , 1 , 2 ) | |
| dup | number | duplicate flag 1 ( true ) or 0 ( false ) . Identifies duplicate packages | |
| retain | number | flag 1 ( true ) or 0 ( false ) . Requrests to retain the message | |
| packetid | number | unique id of the package | |
publish returns
| Type | Description |
| ---- | ----------- |
| Object | { headers , payload , resultCheck ( result ) } |
pubrel
pubrel (version, token, packetid) => {Object}
creates the return types for a receive pubrel message
pubrel Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| version | string | interface version ( '0 . 0' or '1 . 0' ) | |
| token | string | connection token | |
| packetid | number | of the packet ( must be the same id as send by publish ! ) | |
pubrel returns
| Type | Description |
| ---- | ----------- |
| Object | { headers , payload , resultCheck ( result ) } |
subscribe
subscribe (version, topics, clientId, packetid) => {Object}
Subscribes to a client
subscribe Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| version | string | interface version ( '0 . 0' or '1 . 0' ) | |
| topics | Object | { topic : qos , . . . } | |
| clientId | string | unique client identifier | |
| packetid | number, undefined | unique id of the package ( not used on version 0 . 0 ) | |
subscribe returns
| Type | Description |
| ---- | ----------- |
| Object | { headers , payload , resultCheck ( result ) } |
unsubscribe
unsubscribe (version, topics, clientId, packetid) => {Object}
Creats the objects to unsubscribe from a client
unsubscribe Parameters
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| version | string | interface version ( '0 . 0' or '1 . 0' ) | |
| topics | Array | array of topic strings | |
| clientId | string | unique client identifier | |
| packetid | number, undefined | unique id of the package ( not used on version 0 . 0 ) | |
unsubscribe returns
| Type | Description |
| ---- | ----------- |
| Object | { headers , payload , resultCheck ( result ) } |
