MQTTSUB

This block subscribe to a given MQTT topic.

    MQTTSUB

Library

Communicate

Parameters

MQTTSUB_0

NameLabelDescriptionData TypeValid Values

hostname

Hostname

Defines the broker's IP address

String

port

Port

Defines the port number to use.

Scalar

username

Username

Defines the username for authentication.

String

password

Password

Defines the password for authentication.

Vector

topic

Topic

Defines the topic to describe to, the message will be read from that topic.

String

connection

Connection

Defines the MQTT clean session flag.

Structure

connection/clean

Clean session

Number

0
1

connection/persistent

Persistent session

Number

0
1

qos

Quality of Sevice

Defines the Quality of Service to be used for the connection.

Structure

qos/qos0

0

This level guarantees a best-effort delivery. There is no guarantee of delivery. The recipient does not acknowledge receipt of the message and the message is not stored and re-transmitted by the sender.

Number

0
1

qos/qos1

1

This level guarantees that a message is delivered at least one time to the receiver. The sender stores the message until it gets a PUBACK packet from the receiver that acknowledges receipt of the message. It is possible for a message to be sent or delivered multiple times.

Number

0
1

qos/qos2

2

This level guarantees that each message is received only once by the intended recipients. It is the safest and slowest quality of service level.

Number

0
1

keepalive

Keep alive

Defines the number of seconds after which the broker should send a PING message to the client if no other messages have been exchanged in that time.

Scalar

timeout

Timeout

Maximum number of milliseconds to wait for network activity in the select() call before timing out. Set to 0 for instant return. Set negative to use the default of 1000ms.

Scalar

maxiter

Maximum numbers of retries

Maximum number of retries if the data is not recieved.

Scalar

MQTTSUB_1

NameLabelDescriptionData TypeValid Values

nout

Number of outputs

Defines the number of outputs

Number

outports

Output ports

Defines the data type and size for each output.

Structure

outports/rowsize

Row size

Defines the row size for each output.

Cell of scalars

outports/colsize

Column size

Defines the column size for each output.

Cell of scalars

outports/datatype

Data Type

Defines the data type for each output.

Cell of strings

'double'
'int32'
'int16'
'int8'
'uint32'
'uint16'
'uint8'
'boolean'

messageformat

Message Format

Defines the Format of the message.

Structure

messageformat/text

Text

Number

0
1

messageformat/json

Json

Number

0
1

message

Message

Defines the message format to be read. This message can be of any format (text, JSON, ...). User can use %%1, %%2, ..., %%n to identify the outputs.

String

jsonfields

Json field names

Structure

jsonfields/name

Name

Cell of strings

separator

Array separator

Defines the separator used for arrays elements.

String

onFailure

Do on failure

Defines the behavior on failure.

Structure

onFailure/error

Error

Number

0
1

onFailure/warning

Warning

Number

0
1

verbose

Verbose

If set, some information are written in the OML command windows. This flag help to debug.

Number

0
1

Ports

NameTypeDescriptionIO TypeNumber

Port 1

explicit

output

nout

Port 2

activation

input

1