March 2018
Beginner to intermediate
410 pages
10h 40m
English
Once we have our Device ID and know which broker we want to use, it's easy to connect to it. We begin by defining an MQTT client variable for our application:
private MqttClient mqttClient = null;
We then create the corresponding MqttClient object (defined in the Waher.Networking.MQTT namespace). Creating the object will automatically connect to the broker:
this.mqttClient = new MqttClient("iot.eclipse.org", 8883, true,
this.deviceId, string.Empty);
The first parameter defines the host name or IP address of the broker. The second defines the port to connect to. The iot.eclipse.org broker supports unencrypted MQTT communication on port 1883 and encrypted communication on 8883. We choose the encrypted version (third ...
Read now
Unlock full access