Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

blazor mqttnet connection fails due to ws vs wss

$
0
0

I'm coding an application in blazor using MQTTNET nuget to connect to hivemq (a public free server)

If I connect without WithTls() It does work when debugging locally but once I upload to github pages it fails because "a https tried to connect to a ws server, it should connect to wss instead".

If I add the Tls it does not connect: Unable to connect to the remote server I tried searching if hivemq has a different address for wss or something but could not find out.

This is the code I'm using, mostly copied from the MQTTNET wiki

mqttClientOptions = new MqttClientOptionsBuilder()                    .WithClientId(ClientID)                    .WithWebSocketServer("broker.hivemq.com:8000/mqtt")                    .WithTls() //with Tls it does not connect, but no error is thrown                    .Build();var result = await mqttClient.ConnectAsync(mqttClientOptions, CancellationToken.None);

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>