Skip to main content

mqttmessage.sendsync()

Publish a message synchronously

Availability

Agent

Returns

Integer — 0 on success, otherwise an error code

Description

This document describes pre-release alpha functionality which is not yet available to developers.
Both the documentation and the functionality it details are preliminary and subject to change.

This method attempts to publish an mqttmessage previously created using mqttclient.createmessage(). It does so synchronously, so the call will block until the message has been considered to be delivered according to the message’s delivery mode (see mqttclient.createmessage()).

The call returns an integer which indicates whether the call publication attempt succeeded or failed: it will be zero if the message was sent successfully, otherwise it will be an error code:

Result Code Value Description
SUCCESS 0 OK
FAILURE -1 Socket error
ERROR_DISCONNECTED -3 Disconnected
ERROR_NO_MORE_MSGIDS -10 Exhausted MQTT message IDs, ie. 65535
ERROR_OPERATION_INCOMPLETE -11 Operation incomplete (a partial operation was discarded)
ERROR_MAX_BUFFERED_MESSAGES -12 Maximum number of buffered messages exceeded