dotnet / MQTTnet

MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
MIT License
4.51k stars 1.07k forks source link

Supporting Blazor.WebAssembly 3.2.0 official release? #933

Closed AztiIluna closed 4 years ago

AztiIluna commented 4 years ago

Describe your question

I have a Blazor.WebAssembly project with a ManagedClient. After starting the Client, I am not able to go further than the OnClientDisconnected event. The exception that I am getting is: "Operation is not supported on this platform.". I have another project with Blazor.Server and exactly the same code, and everything works fine. How is the support of the project with Blazor.WebAssembly?. I tested with:

-Blazor.WebAssembly 3.2.0 official release. -MQTTnet 3.0.11. -MQTTnet.Extensions.ManagedClient 3.0.11

Thank you in advance, and thank you very much for this awesome project.

Which project is your question related to?

chkr1011 commented 4 years ago

Hi, I will add a test Blazor project so that I can verify official support for it. Best Regards Christian

vankooch commented 4 years ago

Hi,

I'm not sure if this works at all in WebAssembly, at least UDP will have some problems, as it is only allowed to use within WebRTC. We should have the same problem in with generic TCP as this is only allowed with use in WebSocket.

For more information

Maybe there is a chance for using the client based on a WebSocket connection.

Best regards

chkr1011 commented 4 years ago

@AztiIluna I tested the lib in a Blazor project and it works fine. as @vankooch already mentioned: You cannot use the TCP transport. I tested it with the Web Socket endpoint (WithWebSocketServer(...)) and it works. I will also test some more things but to me it works (general speaking).

AztiIluna commented 4 years ago

Hi everyone. Thanks for your replies. I will test using Web Socket as soon as I have time.

SeppPenner commented 4 years ago

I agree with @vankooch as well. In Blazor.WebAssembly, there is no way for TCP connections, only WebSockets.