Image is not available
Share your code using our WebSockets Components for
Delphi, CBuilder and Lazarus.

sgcWebSockets is a complete package providing access to WebSockets protocol, allowing to create WebSockets Servers and Clients for Delphi and CBuilder Projects.
Several Protocols and APIs are also supported.

MQTT publish subscribe architecture

The MQTT messages are delivered asynchronously (“push”) through publish subscribe architecture.

Ideal for constrained networks

MQTT control packet headers are kept as small as possible.

Quality of Service (QoS) for MQTT

Three QoS for message delivery could be achieved using MQTT

MQTT client abnormal disconnect notification

When a MQTT client connects to the MQTT server it can define a topic and a message that needs to be published automatically on that topic when it unexpectedly disconnects

MQTT 3.1.1 and 5.0

Component supports MQTT 3.1.1 protocol and latest 5.0 protocol.

  • MQTT Delphi | MQTT .NET
  • MQTT Delphi Demo | MQTT .NET Demo
  • Rad Studio Trial | .NET Trial

Create Connection

// Create websocket client and set server options
oClient := TsgcWebSocketClient.Create(nil);
oClient.Host := '';
oClient.Port := 15675;
oClient.Options.Parameters := '/ws';

// Create MQTT protocol and assign to websocket client
oMQTT := TsgcWSPClient_MQTT.Create(nil);
oMQTT.Client := oClient;

// MQTT Authentication
oMQTT.Authentication.Enabled := True;
oMQTT.Authentication.Username := 'sgc';
oMQTT.Authentication.Password := 'sgc';

// Handle MQTT methods
oMQTT.OnMQTTConnect := OnMQTTConnectHandler;
oMQTT.OnMQTTDisconnect := OnMQTTDisconnectHandler;

// connect to server
oClient.Active := True;


// Subscribe to channel "myTopic"


// Send a message to all subscribers of channel "myTopic"
oMQTT.Publish('myTopic', 'Text message');


// Send a ping to Server

We'd love to hear from you.

We would love to hear about your projects. Got a question? Drop us a mail.

Barcelona, Spain
Mon - Fri / 9AM - 5PM
Image is not available


Spain (Europe)