Description
Data class to hold all connection related options.
Properties
string
Host: Host name or IP address of the broker.int
Port: Port number where the broker is listening on.bool
UseTLS: Whether to use a secure protocol (TLS).SupportedTransports
Transport: Selected transport to connect with. It can beSupportedTransports.TCP
orSupportedTransports.WebSocket
. Its default value isSupportedTransports.TCP
.string
Path: Optional path for websocket, its default is"/mqtt"
.SupportedProtocolVersions
ProtocolVersion: The protocol version that the plugin has to use to connect with to the server. It can beSupportedProtocolVersions.MQTT_3_1_1
orSupportedProtocolVersions.MQTT_5_0
. Its default value isSupportedProtocolVersions.MQTT_5_0
.
Examples
The following example creates a ConnectionOptions
to connect to localhost on port 1883 using the TCP transport and MQTT protocol version v3.1.1.
ConnectionOptions options = new ConnectionOptions {
Host = "localhost",
Port = 1883,
ProtocolVersion = SupportedProtocolVersions.MQTT_3_1_1
};
var client = new MQTTClient(options);