If you're interested in what is being communicated, you normally use a network sniffer, or network protocol analyzer. One of the better ones is called Wireshark (https://www.wireshark.org/). But external sniffers, or network protocol analyzers, have, for obvious reasons, difficulty monitoring encrypted communication. You are left with two options: either you turn off encryption while you use the external tool to examine your communication, or you monitor the communication internally before it is encrypted or after it has been decrypted.
Which method to use depends on the use case. It might be necessary to retain encryption, or something in the communication chain will not work, or work differently. In this case, you are left with only one option: you need to monitor the communication internally.
To facilitate this, the MqttClient class accepts...