MQTTnet
MQTTnet copied to clipboard
Split Client/Broker Code / reduce dependencies
Description
I'm trying to integrate the MQTTnet server/broker into one of my asp.net core 3.1 projects and found out, that the MQTTnet nuget package has tons of dependencies that I don't need (i.e. websockets, name resolution).
Related to
- Client
- ManagedClient
- Server
Describe the solution you'd like
Split out several dependencies into separate projects, so that one can leverage composition and reduce dependencies.
- split client/server
- move websocket stuff out
- move file system stuff out (message retention)
Hi, extracting the server from the core library is already planned for 3.1.x (but this might be not released released next summer).
I am wondering where the "tons" of dependencies are coming from. I had a look at MQTTnet.TestApp.NetCore which has, depending on the build target, 4, 7 or 14 external dependencies. Mostly these are .NET references. And the most are required when using net461. I added netcoreapp3.1 which "only" requires 7 libraries. These can be already reduced to 4 when MQTTnet.Extensions.WebSocket4Net.dll is not used.
I agree that having a hard dependency to Newtonsoft.Json.dll can also be omitted in the future by moving the storage to an official extension project.
Appreciate your response. Looking forward to see the improvements.
By "tons of dependencies" I meant not only the top-level dependencies (these are indeed only a few), but also the sub-level. For example, System.Net.WebSockets.Client brings in quite a few more dependencies which are likely never required in my particular project.
To shed some light: I want to receive messages, do some simple transformations on them, and pass them on via System.Threading.Channels. That's it.
Closing this for now because this change is planned but this will not happen soon.