Giter Site home page Giter Site logo

33152811 / tmqtt2_synapse40_xe10 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bigheadfjuee/tmqtt2_synapse40_xe10

0.0 1.0 0.0 2.1 MB

MQTTClient + synapse40 for Delphi

License: MIT License

Pascal 44.21% HTML 55.43% CSS 0.12% JavaScript 0.22% PHP 0.02%

tmqtt2_synapse40_xe10's Introduction

TMQTT 2 (ALPHA) for Delphi by Jamie I

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

  • There may be a few bugs.
  • It is not currently FPC compatible [Planned]
  • There are some improvements related to socket error handling which I have yet to make inspired by ZiCog's contributions to the original TMQTTClient. Note: You should be aware that it uses part of the Synapse Internet Communications Library for its Socket support so you’ll need to ensure that this is available on your search path.

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);
  try
    // Events
    MQTT.OnConnAck := GotConnAck;
    MQTT.OnPublish := GotPub;
    MQTT.OnPingResp := GotPingResp;
    MQTT.OnSubAck := GotSubAck;
    MQTT.OnUnSubAck := GotUnSubAck;
    MQTT.OnPubAck := GotPubAck;

    if MQTT.Connect then
    begin
      WriteLn('Connected!');
      MQTT.Subscribe('/dev/test', 0);
      MQTT.Publish('/dev/test', 'This is a test message');
    end
    else
      WriteLn('Failed to connect');
  finally
    MQTT.Free;
  end;
end;

procedure GotPub(Sender: TObject; topic, payload: Ansistring);
begin
 WriteLn('Message Recieved on ' + topic + ' payload: ' + payload);
end;

Special thanks for this re-write got to ZiCog for his help and improvements to the TMQTTClient library, which helped enormously.

If you are using my TMQTT then I would to love hear about how you’re using it, if you do appreciate it, please let me know!

tmqtt2_synapse40_xe10's People

Watchers

 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.