Members

clientId :string

Client ID of the current object
Type:
  • string
Source:

contentEncoding :string

The content encoding of the payload
Type:
  • string
Source:

contentType :string

The content type of the payload
Type:
  • string
Source:

payload :binary

The payload in binary format
Type:
  • binary
Source:

receiverObjectId :string

The object identifier of the message receiver
Type:
  • string
Source:

senderDisplayName :string

The DisplayName (field in the /UserInfo mapping in the Gateway) of the message sender
Type:
  • string
Source:

senderObjectId :string

The object identifier of the message sender
Type:
  • string
Source:

senderType :string

The MASPluginSenderType that represents the sender
Type:
  • string
Source:

sentTime :integer

The timestamp in UTC format when the message was sent
Type:
  • integer
Source:

topic :string

The topic of the message
Type:
  • string
Source:

version :string

The version of the message format
Type:
  • string
Source:

Methods

connect(successHandler, errorHandler, masConnectaOptions, clientId)

Connects to a message broker using the connect options and client id
Parameters:
Name Type Description
successHandler function user defined success callback
errorHandler function user defined error callback
masConnectaOptions masConnectaOptions MQTT connect options for client initialization. Use the MASConnectaPlugin.MASConnectOptions() method to create it.
clientId string Client ID of the MQTT client i.e. this device's identification. This value must be unique per broker. If not provided, client_id from msso_config.json is used
Source:

disconnect(successHandler, errorHandler)

Disconnects from the existing connected message broker
Parameters:
Name Type Description
successHandler function user defined success callback
errorHandler function user defined error callback
Source:

initializeMQTTClient(successHandler, errorHandler, clientId, cleanSession)

Initializes the MQTT client
Parameters:
Name Type Description
successHandler function user defined success callback
errorHandler function user defined error callback
clientId string specifies the client ID to initialize the client
cleanSession boolean specifies whether to clean the previous session
Source:

initializeWithPayloadData(successHandler, errorHandler, payload)

Initialize a message with a payload
Parameters:
Name Type Description
successHandler function user defined success callback
errorHandler function user defined error callback
payload binary payload as binary
Source:

initializeWithPayloadImage(successHandler, errorHandler, payload)

Initialize a message with a payload
Parameters:
Name Type Description
successHandler function user defined success callback
errorHandler function user defined error callback
payload base64 payload as an image
Source:

initializeWithPayloadString(successHandler, errorHandler, payload)

Initialize a message with a payload
Parameters:
Name Type Description
successHandler function user defined success callback
errorHandler function user defined error callback
payload string payload as a string
Source:

isConnected(successHandler, errorHandler)

Checks if device is connected to client
Parameters:
Name Type Description
successHandler function user defined success callback
errorHandler function user defined error callback
Source:

payloadTypeAsImage(successHandler, errorHandler)

The payload property in an image src format
Parameters:
Name Type Description
successHandler function user defined success callback
errorHandler function user defined error callback
Source:
Returns:
base64 string

payloadTypeAsString(successHandler, errorHandler)

The payload property in a string format
Parameters:
Name Type Description
successHandler function user defined success callback
errorHandler function user defined error callback
Source:
Returns:
String

publish(successHandler, errorHandler, topicName, message, QoS, retain)

Publish to a topic using the broker connected via connect call
Parameters:
Name Type Description
successHandler function user defined success callback
errorHandler function user defined error callback
topicName string topic to which the user sends the message
message string specified the message to be sent. The message bytes should be a base64 encoded string to support sending images
QoS integer Quality of Service for message delivery.0-> At most once,1-> At least once, 2: Exactly once. Default is 2
retain boolean indication for the broker to persist the messages for a client
Source:

senderTypeAsString(successHandler, errorHandler)

The senderType property in a string format
Parameters:
Name Type Description
successHandler function user defined success callback
errorHandler function user defined error callback
Source:
Returns:
String

stringFromSenderType(successHandler, errorHandler, masSenderType)

The MASConnectaPluginConstants.MASSenderType in a string format
Parameters:
Name Type Description
successHandler function user defined success callback
errorHandler function user defined error callback
masSenderType MASConnectaPluginConstants.MASSenderType specify the MAS sender type
Source:
Returns:
String

subscribe(successHandler, errorHandler, topicName, QoS)

Subscribe to a topic using the broker connected via connect call
Parameters:
Name Type Description
successHandler function user defined success callback
errorHandler function user defined error callback
topicName string topic to which the user needs to subscribe
QoS integer Quality of Service for message delivery.0-> At most once,1-> At least once, 2: Exactly once. Default is 2.
Source:

unsubscribe(successHandler, errorHandler, topicName)

Unsubscribe from a topic
Parameters:
Name Type Description
successHandler function user defined success callback
errorHandler function user defined error callback
topicName string topic to which the user needs to unsubscribe.
Source: