Skip to content

evaluate replacing PubSubClient with an async MQTT client #137

Description

@jibrilsharafi

Context

PubSubClient (include/mqtt.h:11) is synchronous - publish() blocks until the TCP write completes, and the keepalive ping is driven from loop() calls in our MQTT task. Under load (slow WiFi, large payload, TLS retransmits) this blocks the LWIP stack and can cause AWS to drop the connection on missed keepalive.

Proposal

Spike on alternatives and pick one:

  • espMqttClientSecure - async, queue-based, supports TLS via WiFiClientSecure
  • AsyncMqttClient (marvinroger) - async on top of AsyncTCP (already a dependency)

Eval criteria:

  • Truly non-blocking publish (returns immediately, success/failure via callback)
  • Native TLS support with our existing AWS IoT certificate flow
  • Works with multi-task ownership (publish from any task, callbacks on a known task)
  • No regressions vs current MQTT_BUFFER_SIZE / message rate

Out of scope

Implementation - this is the spike to decide whether to do it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cloudAWS IoT Core, MQTT, and cloud infrastructureenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions