Skip to content

how can I monitor the AWS connection status in AWS_IOT library? #4

Open

Description

@JasonWolfson

Hi,
I would like to monitor AWS connection status. Could you please tell me whether I can do it with AWS_IoT library?

Thanks,
Anusha

Activity

  1. muneebmalik78 commented on Mar 27, 2019

    @muneebmalik78

    Hi,
    I did this by editing two files in the Library named as AWS_IOT.cpp and AWS_IOT.h
    Just Add this Piece of code in AWS_IOT.cpp

    bool AWS_IOT::isConnected()
    {
        bool connectAck = false;
    
        connectAck = aws_iot_mqtt_is_client_connected(&client);
    
        return connectAck;
    }
    

    and Add the definition of this function in AWS_IOT.h as below

    bool isConnected();

    You can use the awsObj.isConnected() to get the current status of Connection.

  2. Luisiado commented on Nov 5, 2019

    @Luisiado

    Hi,
    I did this by editing two files in the Library named as AWS_IOT.cpp and AWS_IOT.h
    Just Add this Piece of code in AWS_IOT.cpp

    bool AWS_IOT::isConnected()
    {
        bool connectAck = false;
    
        connectAck = aws_iot_mqtt_is_client_connected(&client);
    
        return connectAck;
    }
    

    and Add the definition of this function in AWS_IOT.h as below

    bool isConnected();

    You can use the awsObj.isConnected() to get the current status of Connection.

    When you call to the function aws_iot_mqtt_is_client_connected(&client); check the last saved state in the class AWS_IoT_Client but doesnt check or update the real state of connection, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions