Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JasonWolfson opened this issue Oct 25, 2017 · 2 comments
Open

Comments

@JasonWolfson
Copy link

JasonWolfson commented Oct 25, 2017

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

@muneebmalik78
Copy link

muneebmalik78 commented Mar 27, 2019

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.

@Luisiado
Copy link

Luisiado commented Nov 5, 2019

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants