Connectivity Software User's Guide and Reference
EffectiveClientId Property



OpcLabs.EasySparkplug Assembly > OpcLabs.EasySparkplug.System Namespace > EasySparkplugHostApplication Class : EffectiveClientId Property
The effective client ID used for the communication with the broker.
Syntax
'Declaration
 
Public ReadOnly Property EffectiveClientId As String
'Usage
 
Dim instance As EasySparkplugHostApplication
Dim value As String
 
value = instance.EffectiveClientId
public string EffectiveClientId {get;}
public:
property String^ EffectiveClientId {
   String^ get();
}

Property Value

The value of this property cannot be null (Nothing in Visual Basic).

The default value of this property is "" (String.Empty).

Remarks

This method or property does not throw any exceptions, aside from execution exceptions such as System.Threading.ThreadAbortException or System.OutOfMemoryException.

There are limitations to the MQTT client ID as defined by the MQTT protocol specification. These limitations ensure that the client ID is valid and can be used effectively by the MQTT broker. Here are the key constraints:

  1. Length
    • MQTT 3.1.1: The client ID must be between 1 and 23 characters in length. If the client ID exceeds this length, the broker will reject the connection.
    • MQTT 5.0: The client ID can be up to 65535 characters in length. However, brokers may impose their own limits, so it's best to keep the client ID reasonably short.
  2. Uniqueness
    • The client ID must be unique across all clients connected to the same broker. If two clients use the same client ID, the broker will disconnect the existing client when the new one connects.
  3. Allowed Characters
    • In MQTT 5.0, the client ID can include any UTF-8 encoded characters. However, it is recommended to use alphanumeric characters and avoid special characters to ensure compatibility with all brokers. In MQTT 3.1.1, only the characters "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" can be used.

 

Sparkplug is a trademark of Eclipse Foundation, Inc. "MQTT" is a trademark of the OASIS Open standards consortium. Other related terms are trademarks of their respective owners. Any use of these terms on this site is for descriptive purposes only and does not imply any sponsorship, endorsement or affiliation.

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also