MQTT implementation in Basic Multiplayer via webGL Client: Unterschied zwischen den Versionen

Aus hyperdramatik
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 15: Zeile 15:
4. go to ASSESTS -> import packages -> custom packages and get the package from your downloaded folder under packages it might be named like unity3Dmqtt
4. go to ASSESTS -> import packages -> custom packages and get the package from your downloaded folder under packages it might be named like unity3Dmqtt


5. download this two scripts
5. in your assests folder you now should have a MQTT folder open it up and go to the test folder
 
6. delete the testMqtt script
 
7. make a new script and call it exactly -> MQTT_Debug

Version vom 25. Mai 2020, 17:05 Uhr

First things first: I think there is no easy way how webGL could connect to an MQTT Broker directly, maybe there is but I could not figure one out. So the basic idea is to just let the server connect to the MQTT Broker and act as an hub. It as well relaxes the Broker traffic as well.

So the way we communicate is this webGL_Client --> Linux_Server --> MQTT_BROKER --> Linux_Server --> webGL-Client.

Bare this in mind.

So let´s start:

1. Download the MQTT Libary for Unity in this article --> MQTT in Unity

2. unzip the file

3. open up your multiplayer projekt we will work with this projekt -->Unity-Basic-Multiplayer

4. go to ASSESTS -> import packages -> custom packages and get the package from your downloaded folder under packages it might be named like unity3Dmqtt

5. in your assests folder you now should have a MQTT folder open it up and go to the test folder

6. delete the testMqtt script

7. make a new script and call it exactly -> MQTT_Debug