Skip to content

After the disconnection on the server side, the client status remains connected #624

@EthanZhuGit

Description

@EthanZhuGit

The version of mqtt_client used in my app is 10.10.0, and I am using the SaaS version of the Mqtt service.
Here is my code

    _client.logging(on: false);
    _client.keepAlivePeriod = 30;
    _client.autoReconnect = true;
    _client.onConnected = _onConnected;
    _client.onDisconnected = _onDisconnected;
    _client.onSubscribed = _onSubscribed;
    _client.pongCallback = _pong;
    _client.onFailedConnectionAttempt = _onFailedConnectionAttempt;
    _client.onAutoReconnect = _onAutoReconnect;
    _client.onAutoReconnected = _onAutoReconnected;

I occasionally encounter this issue: the pongCallback of MqttServerClient has not been triggered for a long time. Checking the server's connection logs shows that the connection has been closed due to no heartbeats. However, the client's onDisconnected, onAutoReconnect, and onAutoReconnected have not been triggered, and the program still believes that the client is in a normal connection state, while in reality, messages cannot be sent successfully.

I do not understand the underlying details of the MQTT protocol, so I cannot determine whether the issue lies within the mqtt_client library or if the MQTT service from the SaaS provider is not adhering to the standard protocol.

Has anyone encountered this problem, and how should I solve it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions