MQTT

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

simon.schvartzman
Posts: 641
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: MQTT

Post by simon.schvartzman » Wed Jun 17, 2020 1:01 am

Hi Mike/Trevor (or anyone else reading the post) I should be starting a project that will require Mosquitto/MQTT functionalities and I wonder if you would be kind enough to share same code to help me get started with the subject as I'm completely new on this field.

Many thanks in advance.

Regards
Simon
________________________________________
To ";" or not to ";" that is the question

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: MQTT

Post by mwieder » Wed Jun 17, 2020 1:04 am

Simon- what platform? Does the lcb library on Trevor's github site not do what you want?

simon.schvartzman
Posts: 641
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: MQTT

Post by simon.schvartzman » Wed Jun 17, 2020 2:13 am

Hi @mwieder, many thanks for your prompt reply.

Not sure which platform are you referring to, my development environment is LC9.6.0 running on Mac and the App to be delivered is to be run on mobile (both iOS and Android).

I'm pretty sure Trevor's library is going to be a must for my project but I'm confused as how to use it and was hopping to find out a sample stack to be able to save some time reinventing the wheel...

The App itself is expected to be rather simple: allowing the user to choose a command to be sent (from a bunch of similar options) and retrieving/displaying the result of the command execution
Simon
________________________________________
To ";" or not to ";" that is the question

simon.schvartzman
Posts: 641
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: MQTT

Post by simon.schvartzman » Thu Jun 18, 2020 6:14 pm

Mark, I really appreciate your help. Unfortunately I still can't get Trevor's library to work on iOS.

The library appears on the Inclusions Pane as well as in the Extension Manager as can be seen on the screens capture below:
Screen Shot 2020-06-18 at 12.54.18.png
Screen Shot 2020-06-18 at 12.54.18.png (8.75 KiB) Viewed 8209 times
Screen Shot 2020-06-18 at 12.55.48.png
When I run the MosquittoVersion command on my Mac (Mojave & LC 9.6.0) it returns, as expected, the library version: 1.6.2

But when I run the same command on the iPad Simulator (iOS 13.3) I get the following error
Screen Shot 2020-06-18 at 12.59.50.png
I suspect I'm doing something wrong when installing the library.

I'd really appreciate any help to overcome the issue.

Regards
Simon
________________________________________
To ";" or not to ";" that is the question

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: MQTT

Post by mwieder » Thu Jun 18, 2020 6:27 pm

You're going to need the binaries for the iPad, and unless I'm wrong about this, mobile binaries don't exist.

Code: Select all

https://mosquitto.org/download/
You might try compiling from source with XCode, but I doubt that's gonna work.

Code: Select all

https://github.com/eclipse/mosquitto

simon.schvartzman
Posts: 641
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: MQTT

Post by simon.schvartzman » Thu Jun 18, 2020 6:30 pm

So can I consider then that the iOS icon appearing on the Inclusion Pane is a documentation error?

What would I need for Android? it throws an error as well...
IMG_8324.jpg
Thanks again for your help
Simon
________________________________________
To ";" or not to ";" that is the question

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: MQTT

Post by mwieder » Thu Jun 18, 2020 8:26 pm

Yes. Once again, there are no mobile binaries.
You're into uncharted territory here.
You can try building from the source, or possibly google around to see if anyone's been there first.
I have to say I'm not optimistic about your chances.

simon.schvartzman
Posts: 641
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: MQTT

Post by simon.schvartzman » Thu Jun 18, 2020 9:18 pm

I'm surprised (and frustrated) with the fact there is no working solution at the moment.

MQTT is quite popular in the IoT universe and it would make a lot of sense for LC mobile to be able to play that game.

I've sent messages to Trevor (both on this forum and also in FB) asking for help. Hopefully he will answer with ideas, I've no expertise with libraries and the like and therefore can't even try to do it myself

Will see, thanks for your help
Simon
________________________________________
To ";" or not to ";" that is the question

karmacomposer
Posts: 361
Joined: Wed Apr 27, 2011 2:12 pm

Re: MQTT

Post by karmacomposer » Fri Jul 03, 2020 10:38 pm

Yes, we were able to get it to work on 32 and 64 bit windows and mac, but nothing else.

I think the new version has username/password support but not sure and we definitely need it.

Mike

simon.schvartzman
Posts: 641
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: MQTT

Post by simon.schvartzman » Sat Jul 04, 2020 2:15 pm

Hi Mike, in fact there are fields for username/password in the version I've installed on my Mac.

The Initialize button returns

Mosquitto successfully initialized

When running from the IDE the Connect button returns

MosquittoLogCallback
Level: 16
Message: Client mosq/xxxx.....xxxxx sending CONNECT


and that's all, therefore I'm not really sure if it has in fact connected to the server.

On the other hand when running from a Stand Alone the Connect button returns

the input parameters were invalid

Moreover I'm looking to have the stack running on mobile but it seems I've reached a dead end.
I've been in contact with Trevor and this was his answer:
In order for a LiveCode extension to work on a platform you have to compile a library that goes in the ./code folder. Currently there are compiled libraries for macOS and Windows 32/64-bit:
Compiling a library can sometimes be the most time consuming part of developing an extension though. Compiling a C library that will work with a LiveCode extension on iOS or Android isn't something I am familiar with so I can't provide much guidance there. You could try asking on the forums or the mailing list to see if anyone wants to chip in. After all, the beauty of Github and open source is that multiple people can contribute to a project.

Another alternative is to reach out to LiveCode and ask about hiring them to get lc-mosquitto working on mobile. Just be aware that the project was one created for a conference talk. I have not used it in any commercial setting other than running some basic tests.
Bottom line it seems I've hit the wall and would appreciate if someone could help, after all having LC being able to play in the IoT world should be of some value for the platform...

Cheers
Simon
________________________________________
To ";" or not to ";" that is the question

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: MQTT

Post by FourthWorld » Sat Jul 04, 2020 6:30 pm

If there a way MQTT functionality could be provided over HTTP, or are hardware vendors using MQTT with binary dependencies exclusively?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

simon.schvartzman
Posts: 641
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: MQTT

Post by simon.schvartzman » Sun Jul 05, 2020 3:15 pm

Hi Richard,
If there a way MQTT functionality could be provided over HTTP
as far as I know there is no such option available. Would it be, my problem would have been solved...

I've been searching the web for alternatives that would allow LC to interact with Mosquitto servers with no success so far.

May be you find a way to take the rabbit out of the hat...

Best
Simon
________________________________________
To ";" or not to ";" that is the question

karmacomposer
Posts: 361
Joined: Wed Apr 27, 2011 2:12 pm

Re: MQTT

Post by karmacomposer » Thu Jul 09, 2020 6:38 pm

One thing that has to be done is to make a PEM file for username/password to work.

I have no idea how to make a PEM file. My client gave me a username, password and client ID.

Under the Windows version of MQTT there are switches for all three, but I don't see any clientID switch or variable/function in the Livecode version.

PLUS, the PEM file in the new Mosquitto for Livecode is for Trevore's username and password. One has to be created specific to YOUR username and password (or that of your client).

Hopefully, someone can fill us in the these details and how to create a PEM file???

Mike

karmacomposer
Posts: 361
Joined: Wed Apr 27, 2011 2:12 pm

Re: MQTT

Post by karmacomposer » Thu Jul 09, 2020 6:40 pm

As far as I know, MQTT for Livecode will only be PC/Mac unless someone steps up with advanced C++ knowledge on how to compile .dlls for Livecode.

Mike

Post Reply

Return to “Internet”