Searching...

Matching results

    Monitor MQTT Errors

    Note: This is an obsolete legacy page, superseded by content at Using MQTT with AirVantage

    Initializing Table Of Contents...

    MQTT ‘errors’ topic

    When using the MQTT protocol to connect an embedded application to AirVantage, developers can subscribe to the {IMEI or SN}/errors MQTT topic, to get notified when a message contains an invalid payload.

    Monitor JSON errors

    Suppose you publish a message on topic {IMEI or SN}/messages/json with an invalid JSON format:

    // Invalid JSON - timestamp should be a string
    { 12346013564 : { "temperature" : 42 } }
    

    The JSON payload is invalid because the timestamp is expected to be a JSON string (format described in AirVantage Reserved topics page).

    You can subscribe to {IMEI or SN}/errors to receive a message, with a payload containing 3 lines in text format (separated by \n):

    • the topic on which the initial message was published
    • the payload of the message
    • a diagnostic message describing the error

    With the previous request, you would receive:

    {IMEI or SN}/messages/json
    { 12346013564 : { "temperature" : 42 } }
    invalid character '1' looking for beginning of object key string
    

    Monitor CBOR errors

    Suppose you publish on {IMEI or SN}/messages/ts the CBOR corresponding to the following JSON message:

    // Invalid CBOR, a timestamp is missing in the sample
    {
        "h" : [             "x", "y", "z", "lat",    "long",   , "speed" ],
    
        "f" : [ 0.01,        1,   1 ,  1,   1000000,  1000000,   1       ],
    
        "s" : [ 0,   2,   0,   49455177, 537743,    100 ]
    }
    

    Format described in MQTT compressed format for time series page.

    You can subscribe to {IMEI or SN}/errors to receive a message, with a payload containing 3 lines of text (separated by \n):

    • the topic on which the message was published
    • the payload of the message (encoded as UTF-8)
    • a diagnostic message describing the error

    With the previous request, you would receive:

    {IMEI or SN}/messages/tz
    [Encoded payload]
    Not enough CBOR samples at line 0 ; found 6, expected 7. 
    See https://doc.airvantage.net/av/reference/hardware/protocols/mqtt-ts/
    

    More on MQTT

    MQTT.org

    Eclipse Paho

    MQTT standard at OASIS

    Understand the MQTT protocol

    Getting started with MQTT

    TOP