Forum

VL.IO.MQTTnet

An alternative to the already existing VL.IO.M2MQTT, which has a few shortcomings in its underlying library (e.g. no wildcards in topics).
It’s based on MQTTnet and its ManagedClient and features just basic functionality for now.

Needs some more cleanup and testing but will hopefully be released in the next few days.

3 Likes

first release was just published as a nuget. please give it a test ride, feedback welcome:

nuget install VL.IO.MQTTnet -pre

this one features wildcard support and TLS (though no certificates yet. also, it’s not heavily tested as i don’t have too much experience with those yet. but if anybody can show me the way i’d be glad to follow - maybe @cznickesz ?)

now also on github:

1 Like

I´ll have to setup a local mqtt broker using ssl/tsl anyway.
But it´ll take some days, as this week is packed with work.
As soon as it´s up and running, I´ll give it a try.

Meanwhile here is how to generate your own certificate:

https://test.mosquitto.org/ssl/

I had some problems though, as openssl wasn´t installed at the expected path.
I used the installation that comes with git and this helped me out quite a bit:

Best, Chris

2 Likes

You don´t need to (re)install open ssl, just set the path right or copy the config files to the expected position. In the end you´ll need two .crt and one .key file to get it up and running.

The easier way is using the just the server certificate (port 8883 on test.mosquitto.org)
You can download it there (mosquitto.org.crt or mosquitto.org.der)

Today I gave the nuget a try as I was thinking about switching back from node red to vvvv or better vl this time. Unencrypted connection works like charm, but TLS doesn´t seem to work using port 8883 on test.mosquitto.org. I tried TLS protocols 1.1, 1.2, 1.3. I tried using User/Pass. I Allowed untrusted certificates. No success. Did you or anyone else get a TLS-connection to mosquitto.org up and running?

Checked back with node red and connection is up. Broker is up and running.

@motzi can you tell me, how you tested TLS? I guess you installed a local mosquitto broker, right? Can you tell me, how you set it up? tried my local broker which works fine on unencrypted port 1833 but I can´t connect to port 8883 for TLS usage (no certificates used for now).

hey @cznickesz,

thanks for checking that out. tbh i did not really test TLS support yet. test.mosquitto.org was down when i tried it and broker.emqx.io, which also supports TSL on port 8883, worked.

i just tried the mosquitto test-broker again with tls, however, without success. will need to look into that…
if i understand it correctly, one just needs to supply a certificate file when connecting. i tried the provided crt and der files (this functionality is not yet in my nuget) but it did not work as expected on 8883 (did not test 8884 with client certificates).

needs some more investigation…

I am using a dedicated broker now on cloudmqtt.com.
Didn´t get it to work with TLS either.
It does work in node red, even without any certificate.
So I let this part of my setup be done by node red for now.
I´ll keep an eye on this, though and keep on testing now and then.

Concerning mosquitto.org: I didn´t get it to run on 8883 in a reliable form.
Generating the client certificates like described above led to a very solid connection.
But the broker seems to be down quite often for some time.
That´s why I switched to a paid solution now.

did some more investigation regarding the connection problems:
also with some tests of the underlying lib MQTTnet directly i’m unable to connect to test.mosquitto.org with TLS (tried several different options but i can’t figure out how to do it with the server issued certificates directly. maybe a conversion to pfx is necessary but did not try yet).

however: connection using websockets with TLS seems to work. updating the VL nuget for a WS connection should not be too much work, so stay tuned…

grafik

really weird: even without using websockets, by just using a different library method to setup the TLS options (but doing exactly the same things there), i am now able to connect to test.mosquitto.org at port 8883 with TLS 1.2:

(publishing/receiving is possible).
this looks like a bug to me in the base library.

allright, just new nuget is out.

Version 0.1.0 now features

  • WebSocket support
  • Works with TLS (no local certificates yet) - tested with multiple servers
  • minor internl optimizations

please report any issues!

2 Likes