Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
15
Erster Beitrag:
vor 11 Monaten, 1 Woche
Letzter Beitrag:
vor 2 Monaten, 2 Wochen
Beteiligte Autoren:
Terry Mullican, Alen U., kingdr, Allard, Manfred, Tor-Bjarne

MQTT anyone

Startbeitrag von Alen U. am 12.06.2017 19:04

Hi,
WD22 still doesn't have (advertised) mqtt functions.

Does anyone uses WD with MQTT?

Thanks

BR,
Alen

Antworten:

Hi,

I at least fond ZEROMQ (ØMQ) project in the PC-Soft repository, perhaps you can use that?

Cheers
Tor-Bjarne

von Tor-Bjarne - am 12.06.2017 19:58
Thanks Tor-Bjarne,
unfortunately ZEROMQ is not solution in this case.

BR,
Alen

von Alen U. - am 12.06.2017 20:11
Hi,

Maybe this is why the promotion period is extended?

regards
Allard

Tip

Use node red. Free software to do all kind of IOF things and connecting to sensors etc.

von Allard - am 14.06.2017 13:50
Thanks for suggestion Allard.
Devices (various arduino based sensors) are not mine and they "talking" via mqtt so I can't change comunication at all.
Initialy I was not interested in project because of mqtt but then I saw v22 will support it.

BR,
Alen

von Alen U. - am 14.06.2017 16:51
Hi Alen,

I took a look at that note red stuff view months ago. It is really awsome software. Based on note js.

Mqtt is supported in the way of Broker and member etc. It is standard software on the rasparry pi now. Because it supports all you can run it inhouse , not even connecting to the net, if you want as well.

In my opinion it is not ideal to use newly added features directly in projects fo customers. Better wait a version so you know it is stable. but that is just my opinion .( Better be save then sorry )


regards

Allard

von Allard - am 16.06.2017 06:30
Looking for some help on a simple MQTT project. We are testing with WinDev 22 and RabbitMQ but can not get WinDev to make the connection! But we have a node.js / java clients which work fine with the same test server. The WinDev test app sends the MQTT session data but RabbitMQ always thinks it is trying to use the guest account??

PLEASE HELP!

von Terry Mullican - am 15.02.2018 20:41
Hi Terry,
well it has nothing with WinDev.

I have never tried RabbitMQ before.

So on win10 computer I have installed RabbitMQ, Erlang 20.2

This is code on a button (copy from documentation).

gMqttSession is mqttSession

gMqttSession..Address = "localhost"
gMqttSession..Port =1883
gMqttSession..Option = False
gMqttSession..ConnectionTimeOut = 5
gMqttSession..ClientID = 1


IF MQTTConnect(gMqttSession) THEN
Info("Connection OK")
ELSE
Error("Connection problem. '" + ErrorInfo() + "')")
END


and this is NOT working.

But after reading this:
http://www.rabbitmq.com/mqtt.html
and execute this:

rabbitmq-plugins enable rabbitmq_mqtt

It connects without problem.

I didn't run any other test.

Hope that helps

BR
Alen

von Alen U. - am 16.02.2018 18:08
Thanks.

Just a note, your example is NOT using Authentication (User/Password) and I think this is where are having our issues. Seems to only be with RabbitMQ server. We have a test user setup with full rights. But the RabbitMQ server seems to always think we are trying to connection to the guest account. It is like it never sees the username and password in the session variable.

Here is the code...

gMqttSession is a mqttSession
gMqttSession..Address = "10.15.6.42"
gMqttSession..Port = 1883
gMqttSession..Option = False
gMqttSession..ConnectionTimeOut = 9
gMqttSession..User = "testuser"
gMqttSession..UserPassword = "testuser"
gMqttSession..PrivateKey = ""
gMqttSession..PrivateKeyPassword = ""
gMqttSession..ClientID = 1
gMqttSession..CleanSession = True

IF MQTTConnect(gMqttSession) THEN
Info("Connection OK")
ELSE
Error("Connection problem. '" + ErrorInfo(errFullDetails) + "')")
END

And then we get this error on the WinDev side:
https://www.screencast.com/t/3uCqWMZZ4uPp

And this error on the RabbitMQ side:
2018-02-16 13:04:30.702 [info] MQTT vhost picked using plugin configuration or default
2018-02-16 13:04:30.704 [error] MQTT login failed for "guest" auth_failure: Refused

Thanks for any help you can provide...

Terry Mullican

von Terry Mullican - am 16.02.2018 19:08
So far... we have not gotten ANY of the services we have tested with MQTT to use authentication with either username/password or with private key. WinDev can handle anonymous connections but this is useless in secure environment! We would really appreciate any help or advice on this. My team or I are by no means an experts with MQTT but we have tried a lot of combinations with RabbitMQ, Mosquito, ThingSpeak and a few others...

Terry Mullican

von Terry Mullican - am 23.02.2018 15:33
Hi

I try as I am a newbie also but it works a charm, pls see as below:


//btnMQTTPublish sender
gMqttSession is a mqttSession
nLlResult is int
sTopic is string
bufContent is Buffer
ebx4 is string = ""


gMqttSession..Address = "broker.mqttdashboard.com"
gMqttSession..Port = 1883
gMqttSession..Option = False
gMqttSession..ConnectionTimeOut = 2
gMqttSession..User = "myUserName123"
gMqttSession..UserPassword = "myPassword"
gMqttSession..PrivateKey = ""
gMqttSession..PrivateKeyPassword = ""
gMqttSession..ClientID = 1
gMqttSession..CleanSession = True

sTopic = "/SERVER"
bufContent = "Test2Publish"

IF MQTTConnect(gMqttSession) THEN
ebx4="ConnPubOK"
ebx4=ebx4+MQTTPublish(gMqttSession, sTopic, bufContent, True, ...
mqttQualityExactlyOnce)
trace(ebx4)
ELSE
Error("Connection problem. '" + ErrorInfo(errFullDetails) + "')")
END


//btnSubscribe receipient

gMqttSession is a mqttSession
nLlResult is int
sTopic is string
bufContent is Buffer
ebx5 is string = ""

gMqttSession..Address = "broker.mqttdashboard.com"
gMqttSession..Port = 1883
gMqttSession..Option = False
gMqttSession..ConnectionTimeOut = 2
gMqttSession..User = "myUserName123"
gMqttSession..UserPassword = "myPassword"
gMqttSession..PrivateKey = ""
gMqttSession..PrivateKeyPassword = ""
gMqttSession..ClientID = 1
gMqttSession..CleanSession = True


sTopic = "/SERVER"

IF MQTTConnect(gMqttSession) THEN
ebx5="ConnOKS"
lbResult is boolean
lbResult = MQTTSubscribe(gMqttSession, "/SERVER", mqttQualityAtLeastOnce, ...
Proc_MQTTSubscribe)

INTERNAL PROCEDURE Proc_MQTTSubscribe(pMqttSession is mqttSession, ...
Topic is string, abuffer is Buffer)
ebx5=ebx5+abuffer+lbResult
trace(ebx5)
END
ELSE
Error("Connection problem. '" + ErrorInfo(errFullDetails) + "')")
END

HTH

ps you can compile it with an exe run on different computer to test out provided
one is publisher while the other is subscriber.

pls let us know if it's working and share some useful info regarding this as we all new
in this case and would love to hear if you could do with IoT devices.

Cheers

King

von kingdr - am 24.02.2018 08:15
Does this work for you King? And if so, what type of server are you running?

von Terry Mullican - am 24.02.2018 12:53
Terry

Yes, 100% works and broker.mqttdashboard.com (35.157.24.233) is a real public test site from hiveMQ and no idea about other as it's completely new.

You can try out the code that I just gave you.

All I wanna know whether this is it and anything go further pls share with us, like
download hiveMQ private broker to see it works on your computer.

ps better copy my code and try out real and feel it.

HTH

King

von kingdr - am 24.02.2018 17:00
Hello Fellas i was working on other plattform but wanna contribute here too, i was here since 2008 i mean,.

Well i have MQTT server free for your test

Regards

Osvaldo

von Manfred - am 25.02.2018 17:33
King,

broker.mqttdashboard.com does not require credentials and this is the portion of the WinDev code we have not gotten to work. All the servers we have tested without username & password work. None of the servers we have tested work WITH username and password.

Here’s some debug output from Mosquitto when making connections from two different clients:
• 1519925296: New client connected from 10.15.6.96 as testuser111623477 (c1, k60, u'testuser').
This is from mqtt-spy, an MQTT test client. Connection authenticated and was successful. Note the u’testuser’ string, indicating the username passed by the client was testuser.

• 1519925284: New client connected from 10.15.6.96 as testuserqasdfasf (c1, k60).
This is from the WinDev client. Connection was dropped due to failed authentication. Note there is no u’’ string included, indicating there was no username provided by the client. I entered legitimate username/password in the appropriate fields, but they were not passed in the connection attempt.

Please understand our project will require user/password or possibly privatekey.

Thanks, hope this help explain our issue better.

Terry

von Terry Mullican - am 01.03.2018 19:45
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.