TsgcWSPClient_MQTTMethods › Connect

Connect Method

Sends an MQTT CONNECT packet to the broker over the underlying WebSocket transport.

Syntax

procedure Connect;

Remarks

Call Connect once the parent WebSocket client is already connected, to initiate the MQTT-level handshake using the configured Client, Authentication, HeartBeat, LastWillTestament and ConnectProperties. The method returns immediately; the broker's CONNACK is reported asynchronously through the OnMQTTConnect event. Use OnMQTTBeforeConnect to tweak the CONNECT packet just before it is written.

Example

WSClient.Active := True;
MQTT.Connect;

Back to Methods