Class MqttClientOptions
Connection settings for an MqttClient.
public sealed class MqttClientOptions
- Inheritance
-
MqttClientOptions
- Inherited Members
Remarks
Constructed with object-initializer syntax; only ClientId, Host, and Port are required, and the optional fields fall back to the core defaults when left null.
Properties
Capacity
Bound on outstanding client requests. Defaults to 64 when null.
public uint? Capacity { get; init; }
Property Value
- uint?
ClientId
The MQTT client identifier presented to the broker.
public required string ClientId { get; init; }
Property Value
Host
The broker hostname or IP address.
public required string Host { get; init; }
Property Value
KeepAliveSecs
Keep-alive interval in seconds. Defaults to 30 when null.
public uint? KeepAliveSecs { get; init; }
Property Value
- uint?
MaxPacketSize
The largest packet the connection sends or accepts, in bytes. Defaults to 10,240 when null.
public uint? MaxPacketSize { get; init; }
Property Value
- uint?
Remarks
A packet is a message's topic and payload plus a few bytes of framing. A publish that would be larger is refused and the connection stays up, but a larger packet arriving from the broker ends the connection, so every client that shares a topic needs a limit that fits it.
Password
The password to sign in with, which needs a Username.
public string? Password { get; init; }
Property Value
Remarks
It travels in the clear unless the connection uses Tls.
Port
The broker TCP port, conventionally 1883 for plaintext MQTT.
public required ushort Port { get; init; }
Property Value
Qos
Default quality of service. Defaults to AtLeastOnce when null.
public Qos? Qos { get; init; }
Property Value
- Qos?
Tls
TLS settings; a connection with them is secured, conventionally on port 8883.
public MqttTls? Tls { get; init; }
Property Value
Username
The name to sign in to the broker with.
public string? Username { get; init; }
Property Value
Will
A message the broker publishes if the connection ends without a goodbye.
public MqttWill? Will { get; init; }