Code Monkey home page Code Monkey logo

dmqtt's Introduction

mail: [email protected]

Develop IDE Delphi 10.2 Version 25.0.26309.314

Features

Future SSL

android

IOS

DLL/.So

socket api use Delphi-Cross-Socket

WiNDDRiVER([email protected])

https://github.com/winddriver/Delphi-Cross-Socket.git

TMQTT 2 (ALPHA) for Delphi by Jamie I and join

Introduction

WARNING: This is still considered ALPHA quality, and is NOT considered ready for any real use yet. All contributions and bug fix pull requests are appreciated.

TMQTT is a non-visual Delphi Client Library for the IBM Websphere MQ Transport Telemetry protocol ( http://mqtt.org ). It allows you to connect to a Message Broker that uses MQTT such as the Really Small Message Broker which is freely available for evaluation purposes on IBM Alphaworks. Mosquitto is an open source MQTT 3.1 broker ( http://mosquitto.org/ ).

TMQTT is a complete re-write of the original TMQTTClient that I wrote and it is sufficiently different enough to release in parallel.

MQTT is an IoT protocol, further information can be found here: http://mqtt.org/

Points of Note

you must test, but i tested.

Usage

There is a sample VCL project included in the download but usage is relatively simple. This is a non-visual component so all you need to do is to put the TMQTT directory into your compiler paths and then put MQTT in your uses.

uses MQTT;
var
  MQTTClient: TMQTT;
begin
  MQTT := TMQTT.Create('localhost', 1883);
 
  MQTT.WillTopic := '';
  MQTT.WillMsg := '';
  
  MQTT.Username := edt_UserName.Text;
  MQTT.Password := edt_TestPassWord.Text;
  MQTT.ClientID := edt_UserName.Text;

  // Events
  MQTT.OnConnAck := GotConnAck;
  MQTT.OnPublishBytes := GotPubBytes;
  MQTT.OnPubAck := GotPubAck;
  MQTT.OnPubRec := GotPubRec;
  MQTT.OnPubRel := GotPubRel;
  MQTT.OnPubComp := GotPubComp;

  MQTT.OnPingReq := GotPingReq;
  MQTT.OnPingResp := GotPingResp;
  MQTT.OnSubAck := GotSubAck;
  MQTT.OnUnSubAck := GotUnSubAck;

  MQTT.OnPubAckSend := GotPubAckSend;
  MQTT.OnPubRecSend := GotPubRecSend;
  MQTT.OnPubRelSend := GotPubRelSend;
  MQTT.OnPubCompSend := GotPubCompSend;
  MQTT.OnPublishSend := GotPubSend;
  MQTT.OnSubSend := GotSubSend;
  MQTT.OnUnSubSend := GotUnSubSend;

  MQTT.OnConnect := GoConnect;

  MQTT.Connect();

  
end;

procedure TfMain.GotPubBytes(Sender: TObject; topic: string; PackageId: integer; payload: TBytes; QOS: integer);
var
  cnt: Ansistring;
begin
  inc(Rcv);
  self.Caption := ' rcv count:(' + inttostr(Rcv) + ')';

  SetString(cnt, PAnsiChar(@payload[0]), length(payload));
  mStatus.Lines.Add(GetCurrentDateTime + ': rev  << publish message on topic:' + string(topic) + ', PackageId:' +
    inttostr(PackageId) + ', qos:' + inttostr(QOS) + ', payload: ' + string(cnt));

end;

dmqtt's People

Contributors

join2017 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.