This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

connect MQTT Broker from web and inside LM
#1
I am trying to use LM broker app and publish/subscribe to it from webpage.
From the webpage I use websocket so the broker should open the port 8080 or 8081...
Also I need to prepare resident script to publish any change in KNX network so  the broker should also have port 1883 or 8883.

Am I able to open all of these ports with LM broker app?
Reply
#2
The broker talks only via MQTT so you only need port 1883 or 8883. You don't have to open anything on LM just make sure nothing else is blocking it on the way as router or some firewall.
------------------------------
Ctrl+F5
Reply
#3
(02.08.2022, 13:55)Daniel Wrote: The broker talks only via MQTT so you only need port 1883 or 8883. You don't have to open anything on LM just make sure nothing else is blocking it on the way as router or some firewall.

Thank you Daniel!

Okay, this is the html code I uploaded on the public directory of LM but it does not work... do you see anything strange ?

Code:
<html>
<head>
  <script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<meta charset="utf-8">
<title>MQTT TEST</title>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://unpkg.com/mqtt/dist/mqtt.min.js"></script>
<script>
$(function(){

   let client = mqtt.connect('ws://127.0.0.1:1883');
   let topic = "floor1/room1"
   let msg = '{"alias": "1/1/3", "value": 10}'

   client.subscribe(topic);
   client.publish(topic, msg);

   client.on('message', function (topic, message) { // message is Buffer
   console.log(message.toString());
});
});
</script>
</head>
<body>
</body>
</html>
Reply
#4
LM broker does not have websocket support. 127.0.0.1 in this case will try to connect to the client itself not to LM.

You don't need MQTT to access objects, you can use this: https://forum.logicmachine.net/showthrea...13#pid2913
Reply
#5
Thank you , admin !
Never expected this way !

Where do I get the package of js/localbus.js.gz and scada/vis/busdecode.js.gz ?
Are there already in LM ?
Reply
#6
It's built-in. Same files are used by visualization and Mosaic.
Reply
#7
Wow Idea

Yes it actually worked ! 

You guys are genius, LM is amazing !

Thank you admin and Daniel  Smile
Reply


Forum Jump: