MQTT in Processing: Unterschied zwischen den Versionen

Aus hyperdramatik
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
Zeile 6: Zeile 6:




=SHIFTR ONLINE=
 
=SHIFTR Desktop App=
 
Download the Shiftr MQTT library (see above).
 
Open the Shiftr MQTT example (see above).
 
 
Insert your IP address instead of the Shiftr URL:
 
<source lang="js" line start="2" highlight="4-6">
 
client.connect("mqtt://192.168.0.9", "processing”);
 
</source>
 
 
if you need to use a different port number other than the default 1883 (for example 2883), you can specify it like this:
 
<source lang="js" line start="2" highlight="4-6">
 
client.connect("mqtt://192.168.0.9:2883", "processing”);
 
</source>
 
 
 
=SHIFTR Online=


To code a Proccessing Client we use Shiftr's MQTT library for Processing.
To code a Proccessing Client we use Shiftr's MQTT library for Processing.
Zeile 41: Zeile 68:
"mqtt://name_of_your_instance:token_secret@url_of_your_instance.cloud.shiftr.io:2883"
"mqtt://name_of_your_instance:token_secret@url_of_your_instance.cloud.shiftr.io:2883"
</em>
</em>
=SHIFTR Desktop App=
Download the Shiftr MQTT library (see above).
Open the Shiftr MQTT example (see above).
Insert your IP address instead of the Shiftr URL:
<source lang="js" line start="2" highlight="4-6">
client.connect("mqtt://192.168.0.9", "processing”);
</source>
if you need to use a different port number other than the default 1883 (for example 2883), you can specify it like this:
<source lang="js" line start="2" highlight="4-6">
client.connect("mqtt://192.168.0.9:2883", "processing”);
</source>

Aktuelle Version vom 17. Mai 2022, 15:31 Uhr

see also MQTT Brokers and https://www.kobakant.at/DIY/?p=9140

Shiftr has libraries for various platforms including Arduino and Processing that make it very easy to code MQTT Clients.

https://www.shiftr.io/


SHIFTR Desktop App

Download the Shiftr MQTT library (see above).

Open the Shiftr MQTT example (see above).


Insert your IP address instead of the Shiftr URL:

client.connect("mqtt://192.168.0.9", "processing”);


if you need to use a different port number other than the default 1883 (for example 2883), you can specify it like this:

client.connect("mqtt://192.168.0.9:2883", "processing”);


SHIFTR Online

To code a Proccessing Client we use Shiftr's MQTT library for Processing.

Install Library

Sketch --> Import Library --> Add Library --> filter: "MQTT" install "MQTT library for Processing based on the Eclipse Paho project by Joel Gaehwiller"

Open Example

File --> Examples --> MQTT --> "PublishSubscribe"

The following line of code connects you to the online Shiftr Broker's public namespace called "try" with the Client ID "processing".

client.connect("mqtt://public:public@public.cloud.shiftr.io", "processing");

Notes: Make sure the URL in your code is the same as the current URL shown on the public namespace website:

"mqtt://public:public@public.cloud.shiftr.io"

If you are using your own namespace, make sure you edit the URL to include:

name_of_your_instance

token_secret

url_of_your_instance

"mqtt://name_of_your_instance:token_secret@url_of_your_instance.cloud.shiftr.io"


if you need to use a different port number other than the default 1883 (for example 2883), you can specify it like this:

"mqtt://name_of_your_instance:token_secret@url_of_your_instance.cloud.shiftr.io:2883"