Code Monkey home page Code Monkey logo

mqtt's Introduction

Bond Keevil's MQTT Component Pack for Lazarus

Message Queue Telemetry Transport (MQTT) client and server component pack for Lazarus/FPC with demo applications.

Project Goals:

  1. Implements the MQTT protocol specification 3.1.1 completely and accurately
  2. Implements all QoS levels
  3. Is not dependent on a specific networking component or transport mechanism
  4. Has reasonable documentation

For the client and server demo applications I have been using the LNet components because they seem to run well on both Windows and Linux.

There is a GUI client application and server application as well as a server command line application. These demonstrate the features of the component set and are useful for testing MQTT based applications.

MQTT Brokers are not implemented and there is no security authentication provided by this component. You must provide your own authentication methods by implementing appropriate event handlers

Status Update November 2019

This project can be considered stable. I don't intend to do any more development work on this component set as I'm focused on developing version 2 in C++. Version 2 will support MQTT 3.1, 3.11 and 5.0 protocol versions for both client and server. It should be released by the end of the year.

Installation

To build this package you will need to check out and install my "bkutils" package on which this package depends. This is my general utilities package. This package provides my TBuffer class which this component set uses extensively.

Older versions of my bkUtils package also depend on my CryptoPKG package. The new version, which will be released shortly will depend on the DCPCrypt library. My CryptoPKG was a modified version of DCPCrypt but those modifications will be incorporated into my bkUtils package instead.

To build the demo applications you will also need to install LNet. For me, the only version of LNet that works is the one available in the Lazarus online package manager, I am not sure why.

Documentation

The documentation is written in markdown and is available in the docs directory.

License

This component is released under the GNU LGPL license agreement. You may share it, extend it, or use it for any commercial purposes provided you share any improvements you make to the code. It is not necessary to distribute this source code with your binaries.

mqtt's People

Contributors

bkeevil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mqtt's Issues

Error on Raspberry Pi

Hi. I got a new Raspberry Pi 4 and installed Lazarus 2.0.2 on it. Took ssome time but I got all the packges installed and the IDE rebuild.

I compile the mqttclient app.

image

But as soon as I open it I get this error.

image

It seems it is coming from the LNet package.

image

Missing dependency/file?

Hi Bond
Followed your readme to compile but file passwordman.pas uses StreamUtils which is not in your lazarus repo. Where can I find this file or will you add it?

Petr

LNet ?

Hi.

I am confused. I installed a clean copy of Lazarus 1.8.
I tried to install your components but it is looking for iNet Visual.

Where do I get that? You state you are using LNet so I am a bit confused at this stage.

Regards.

missing units

Hi,
Tryed to compile mqttclient.pas but it throws an error about missing units Buffers.pas and Logging.pas
Where are they located?

best regards,
Stefan

Update FPDocs

Documentation is being generated using Lazarus FPDocs. The source for the docs is in the docs directory. It needs to be fleshed out a little. A good way for someone to learn the code.

MQTTServer.pas needs to be updated

TMQTTPacketIDManager Improvement

Should be modified so that an array of words isn't being stored in a TList object. Typecasting pointers to Words is not portable and could cause problems down the road. I was thinking it should be a list of pointers to words that are dynamically allocated as needed.

Logging to a file

Provide for logging output to a file in the CLI server application

Add a Subscriptions collection property to TMQTTClient

It would be better if client subscriptions could be stored in the lfm file rather than having to add them during the InitSession event handler.

The existing Client.Subscriptions property uses an object list and isn't really all that useful.

Change the TMQTTClient component to use a TCollectionItem for storing Subscriptions instead.

Remove the OnSubscriptionsChanged event handler, which was not really useful other than for debugging.

Thread Safety

Apologies for my possible ignorance...

After having a quick look at the code... I see many threads being created, Lists and Queues but no CriticalSections/Locking.

Are there components Thread Safe?

TMQTTServer ClientID Whitelist and Blacklist

Presently all it does is trigger an event

function TMQTTServer.ValidateClientID(AClientID: UTF8String): Boolean;
begin
  Result := True;
  if Assigned(FOnValidateClientID) then
    FOnValidateClientID(Self,AClientID,Result);
end;                            

TODO: Remove the dependency on TPasswordManager

The MQTT components should not depend on my utility and crypto packages. This will require removing the use of TPasswordManager by TMQTTServer. Future versions of this package should trigger an event to validate usernames and passwords.

TMQTTRetainedMessages Component

Retained messages currently stored in RAM and managed by TMQTTServer and are lost whenever the server process restarts. Ideally, retained messages should be stored in a file so that they can persist between server instantiations.

A similar mechanism exists in Mosquitto server.

Delphi version?

It would be fantastic if this was made to work with Delphi since it is the only MQTT solution that seems to handle the full MQTT 3.1.1 spec as well as SSL/TLS.

Will a Delphi (10.2) version be available in a near future?

example for free pascal only (not laz)

Hi,
I try to get client and serverapp running on a raspberry pi (3B+ with raspbian lite (no desktop)) with free pascal only, not lazarus.
Is there an example code to achieve it.
Thanks,
Rudi

Add a way to set the persistent property of a subscription in the server test app

On the subscriptions tab there should be a checkbox column titled "persistent" that updates the persistent property of a subscription. A subscription marked persistent should be saved to a server configuration file.

There is a mechanism to load/save persistent subscriptions to a stream but it is not being used. See TMQTTSubscriptionList.LoadFromStream/SaveToStream

It would probably be better to load/save this as an inifile or in some other text format.

The command line options and command line help needs to be updated with a way to specify a persistent subscriptions file.

The startup process needs to be modified to load a persistent subscriptions file at startup.

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.