This code is set up to get you creating your message handlers outside of your MQTT library, and then inject them into the library programmatically, so that your library can remain immutable while you create custom message handler logic for your individual projects. The logic is explained in the YouTube video MQTT - ESP32 Handle Messages Using PubSubClient.h.
👉 Subscribe to the OhioIoT YouTube Channel for more on "All Things IoT": hardware, firmware, connectivity, cloud computing, and dev toolkit.
OhioIoT is an IoT platform designed for small-scale IoT projects (https://www.ohioiot.com).