Closed Cronyet closed 1 year ago
You're right, this is actually a problem needs to be solve.
Tracked by #223 .
Considering that some surrounding facilities are inconvenient to migrate, I suggest rebuilding on the basis of the original project first, rather than creating a new project, just like what you are doing now.
Crequency/KitX-Dashboard#19 has been merged, we can close this issue while changes in KitX/dev=main merged into KitX/main
🪦 Is your feature request related to a problem? Please describe.
Talk about
KitX Dashboard
. Currently, the code related to network services exists in theServers
directory. There are only two files:PluginsServer.cs
DevicesServer.cs
Among them,
DevicesServer.cs
also contains the code of two parts, the device self-discovery network and the master-slave device communication network. All these codes jumbled together, as a result, there is no way to expand new functions easily at the same time. The state control of network services can only be distinguished byPluginsServer.cs
andDevicesServer.cs
. Restarting the device service must restart the device self-discovery network and the master-slave device communication network at the same time, instead of simply restarting one of them.So, I opened this issue. I am going to have a discussion with you about refactoring the code related to network services
🪧 Describe the solution you'd like
The following is my refactoring idea:
We need a new library project, for example:
KitX.Web.Core
, placed in theKitX Dashboard Helper
repository. Migrate all network related code to this project. Use more closure semantics to refactor network-related logic to prevent code inKitX.Web.Core
from accessingKitX Dashboard
. We need a network server interface design, for example:IKitXNetworkServer
and it is required that the class that implements this interface must implement methods such asStart()
,Stop()
, etc. for better state control. In addition, we need to separate the device self-discovery network from the master-slave device communication network, so that one of the networks can be controlled independently🧾 Describe alternatives you've considered
It's going to be a lot of work, but it's still worth it.
📎 Additional context
No response