gpvigano / m2mqttunity Goto Github PK
View Code? Open in Web Editor NEWM2MQTT for Unity
License: MIT License
M2MQTT for Unity
License: MIT License
- version of Unity3D 2018.all, 2019.1
Hi, i make mqtt autoconnect true and it works flawless, but if the mqtt broker is down all the ui remain freezed until timeout (put to 30sec). Is there a way to avoid this?
thanks for your great work
- version of M2MqttUnity 9a030e5
- version of Unity3D (e.g. Unity 2020.3.14f1c1)
After disconnecting and reconnecting, the DispatchEventThread method is stuck in this.receiveEventWaitHandle. WaitOne(),
Until the server actively disconnects.
Hey :)
Love your work!
We now need to use the app on WebGL. Is there any chance in future to see this working?
Thanks!!
I made a game scene in Unity that has several objects and each object displays the value of a sensor, such as a temperature sensor. These sensors should communicate with our broker and display the values. I did this with M2MQTT and in game mode in Unity, I can connect to the broker located on another server and receive the values. . When I exit the game in WebGL format, I see that it cannot connect to the broker, not even any other broker. What is the solution? Thankful.
We expected connection delay in 10ms. So we code connectionDelay = 10;
But we get approximately 900ms.
Hello there!
I'm using a single MQTT client, but when I try to subscribe tu multiple MQTT topics at the same time I'm receiving errors (when only one topic is subscribed everything works well)
Hi, I am using this for my android and iOS game, and is working flawlessly
Thank you for that.
Now, i wanted to use MQTT for my another project which is for WebGL and it also requires authentication.
So, is there any chance of it supporting this?
Any help will be highly appreciated.
If I build the unity app with il2cpp and deploy it to hololens2, I am getting an error during client connection. While compiling it with .NET, no such error appears. The issue is that ,NET compatibility has been removed in recent Unity releases.
hello, im new to m2mqtt and im trying to use this project to subscribe from a broker, is it compatbile?
M2MqttUnity commit: 2ce51ed
Unity 3D versions: 2017.1.0f3, 2017.1.4f1, 2018.1.9f1, 2018.2.5f1
Open the M2MqttUnity_Test example scene.
Run it in Editor or build on Windows Standalone or Android.
Enable encryption, try to connect to a broker (e.g. iot.eclipse.org).
Connection successful (activating encryption and choosing the proper port, e.g. 8883 for mosquitto brokers).
While no problem was found using a not encrypted connection,
testing the included example also with encryption
it does not work on Windows Standalone, Android (and even in Unity Editor), but
it works when built on UWP/Windows 10 (PC and HoloLens).
Failed to connect to iot.eclipse.org:8883:
uPLibrary.Networking.M2Mqtt.Exceptions.MqttConnectionException: Exception connecting to the broker ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.
at Mono.Security.Protocol.Tls.RecordProtocol.ProcessAlert (AlertLevel alertLevel, AlertDescription alertDesc) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at uPLibrary.Networking.M2Mqtt.MqttClient.Connect (System.String clientId, System.String username, System.String password, Boolean willRetain, Byte willQosLevel, Boolean willFlag, System.String willTopic, System.String willMessage, Boolean cleanSession, UInt16 keepAlivePeriod) [0x00039] in D:\Unity3D\Projects\IoT\M2MqttUnity\Assets\M2Mqtt\MqttClient.cs:565
at uPLibrary.Networking.M2Mqtt.MqttClient.Connect (System.String clientId) [0x0000d] in D:\Unity3D\Projects\IoT\M2MqttUnity\Assets\M2Mqtt\MqttClient.cs:485
at M2MqttUnity.M2MqttUnityClient+<DoConnect>c__Iterator0.MoveNext () [0x001d2] in D:\Unity3D\Projects\IoT\M2MqttUnity\Assets\M2MqttUnity\Scripts\M2MqttUnityClient.cs:304
UnityEngine.Debug:LogErrorFormat(String, Object[])
M2MqttUnity.<DoConnect>c__Iterator0:MoveNext() (at Assets/M2MqttUnity/Scripts/M2MqttUnityClient.cs:309)
(see also eclipse/paho.mqtt.m2mqtt#21)
Hello. I've set up the connection in Unity based on this Git repository and I'm in the process of creating an app for iOS. When I test it on my PC everything works fine and I can connect to the broker just fine. The broker runs on Node-RED on a home PC.
But as soon as I build the app and start it on my phone, I get the error message: "no route to host" and "connection failed". Anyone know why that is? However, when I use an online broker like: broker.mqttdashboard.com, it works fine on mobile. But as soon as I try it with my Node-RED broker, it doesn't work. The IP address is 192.168 etc.. and I use port 1883.
The app must necessarily connect to a broker that is on the local network. It's not my broker's settings or any other authentication issues.
Could anyone help me, please? Would be very grateful!
Windows 10
Unity version 2017.4.3f1
Downloaded the repository on 10/05/2019
Visual Studio Version 2017
HoloLens 1
To see the following output,
Test message published
Receive: Test message
Following error
Connected to iot.eclipse.org:1883...
(Filename: C:\buildslave\unity\build\artifacts/generated/Metro/runtime/DebugBindings.gen.cpp Line: 51)
Test message published
(Filename: C:\buildslave\unity\build\artifacts/generated/Metro/runtime/DebugBindings.gen.cpp Line: 51)
'M2MqttUnity.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\M2MqttUnityVS.Release_x86.per287\System.Diagnostics.StackTrace.dll'. Cannot find or open the PDB file.
Exception thrown: 'System.InvalidOperationException' in Assembly-CSharp.dll
Exception thrown: 'uPLibrary.Networking.M2Mqtt.Exceptions.MqttCommunicationException' in Assembly-CSharp.dll
Exception thrown: 'System.AggregateException' in System.Private.CoreLib.ni.dll
The thread 0x13b8 has exited with code 0 (0x0).
The thread 0xfdc has exited with code 0 (0x0).
The thread 0x700 has exited with code 0 (0x0).
The thread 0x179c has exited with code 0 (0x0).
Exception thrown: 'uPLibrary.Networking.M2Mqtt.Exceptions.MqttCommunicationException' in Assembly-CSharp.dll
Failed to connect to iot.eclipse.org:1883:
uPLibrary.Networking.M2Mqtt.Exceptions.MqttCommunicationException: Exception of type 'uPLibrary.Networking.M2Mqtt.Exceptions.MqttCommunicationException' was thrown.
at uPLibrary.Networking.M2Mqtt.MqttClient.SendReceive(Byte[] msgBytes, Int32 timeout)
at uPLibrary.Networking.M2Mqtt.MqttClient.SendReceive(MqttMsgBase msg, Int32 timeout)
at uPLibrary.Networking.M2Mqtt.MqttClient.Connect(String clientId, String username, String password, Boolean willRetain, Byte willQosLevel, Boolean willFlag, String willTopic, String willMessage, Boolean cleanSession, UInt16 keepAlivePeriod)
at M2MqttUnity.M2MqttUnityClient.d__38.MoveNext()
(Filename: C:\buildslave\unity\build\artifacts/generated/Metro/runtime/DebugBindings.gen.cpp Line: 51)
I'm hoping I can get some help with an issue I'm having.
After running a build for 2-3 hours with no interactivity, I start getting this error and the app no longer receives any data from MQTT.
NullReferenceException: Object reference not set to an instance of an object
at M2MqttUnity.M2MqttUnityClient.ProcessMqttMessageBackgroundQueue () [0x00016] in <a142f2b118d44b049fd51176acc445ad>:0
at M2MqttUnity.M2MqttUnityClient.ProcessMqttEvents () [0x00012] in <a142f2b118d44b049fd51176acc445ad>:0
at M2MqttUnity.M2MqttUnityClient.Update () [0x00000] in <a142f2b118d44b049fd51176acc445ad>:0
at MyM2MqttUnityScript.Update () [0x00000] in <a142f2b118d44b049fd51176acc445ad>:0
Any one might be of help as to why this might be happening?
Thanks you in advance.
Hello,
The code works well for Eclipse IoT MQTT broker (iot.eclipse.org and mqtt.eclipseprojects.io), but if i try the MQTT project with other MQTT brokers like HiveMQ, the script is throwing an exception (screenshot attached).
Has anyone tried to use this package with a different MQTT broker other than Eclipse IoT Broker?
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.