March 2018
Beginner to intermediate
410 pages
10h 40m
English
Connecting to a broker is an asynchronous process that is error-prone and can take time. Applications should always strive to provide relevant feedback to their users as quickly as possible. For asynchronous communication processes, such relevant feedback can be showing the state of the process. The MqttClient object allows us to monitor this state, through the OnStateChanged event. For our example, we log each state change as an event:
this.mqttClient.OnStateChanged += (sender, state) =>
Log.Informational("MQTT client state changed: " +
state.ToString());
Read now
Unlock full access