Post your nifty GP projects here!

Moderator: MSandro

Post Reply
Posts: 330
Joined: Jul 2nd, '17, 13:47


Post by SimpleSi » Sep 22nd, '17, 13:27

This post is going to be short as I've already typed it once and then lost it before I pressed send so this time I'm going to post and the edit and re-post until its done!

For info on MQTT - see

I tried making this project as an exercise in seeing if it could be done in GP and I suceeded :)

I had to access some of the primitive GP blocks that haven't been exposed (mainly socket and binary data functions) by delving thru the runtime/lib .gp files but I managed to do it (and learnt a LOT in the process)

The icing on the cake came when JM explained the extension mechanism to me and so here is my first GP extension
To Do
Allow choosing of client name (currently its timervalue + random num)
Allow for non-clean sessions
Allow choosing of retained messages
Get QoS 2 to work
Handle large (and non-alphanumeric) messages
implement username/passwords

Download the attachment

Right-click on stage area and select "load extension" and load this download from wherever you've saved it

You should now see a new MQTT category below My Blocks

Presently the extension only handles simple QoS 0 and 1 traffic and the messages must be alphanumeric

MQTTConnection connects to a broker (I run a test one at cycy42.ddns.net for testing that you are free to test with)

MQTT Subscribe lets you set up subscriptions to topics

MQTTPublish lets you publish messages to topics

MQTTMessages reports a dictionary of topics and their messages that you are subscribed to
To get just a single topic value from it - click on black arrow and set topic that way

MQTTDisplayInfo (true/false) lets the extension say MQTT info messages - I use it for debugging and seeing if everything is work OK

I attached an example usage program that uses the extension

Any feedback appreciated
(21.79 KiB) Downloaded 145 times
(24.25 KiB) Downloaded 120 times

Post Reply