Connect method
Connects to the broker. Each MQTT client should create a connection to the broker through this method.
Syntax
retCode
= mqttClient
.Connect
(connOption
As MQTTConnectOption
)where
retCode
- is a constant of the MqttConnectionCode object.mqttClient
- is an MQTTClient object created by the MQTTFactory object's method CreateClient
.connOption
- is the name of an MQTTConnectOption object or an expression that evaluates to an MQTTConnectOption object.Example
Dim connOption As MQTTConnectOption Dim retCode As MqttConnectionCode Set connOption = MqttFactory.CreateConnectOption() connOption.Version = MqttVersion500 connOption.Protocol = MqttProtocolTcp connOption.Host = "localhost" connOption.Port = 1883 connOption.ClientID = "client_1" ' If this property is omitted, SE Client will automatically generate random a client ID, starting with "SE_". ' use other options retCode = mqttClient.Connect(connOption)
Provide Feedback