added inital server communcation task

This commit is contained in:
2025-09-27 21:34:30 +02:00
parent 67ebbdaa19
commit 67b24b33aa
4 changed files with 165 additions and 52 deletions

View File

@@ -73,11 +73,17 @@ pub struct HardwareDto {
pub ip_address: String,
}
#[derive(Debug, Deserialize)]
#[serde(tag = "command", content = "data")]
pub enum ServerMessage {
Update(String),
Restart,
#[serde(other)]
Unknown,
#[derive(Debug, Deserialize, Clone)]
pub struct ServerMessage {
// Define your message structure here
pub message_type: String,
pub data: serde_json::Value,
pub message_id: String, // Add an ID for acknowledgment
}
#[derive(Debug, Serialize, Clone)]
pub struct Acknowledgment {
pub message_id: String,
pub status: String, // "success" or "error"
pub details: String,
}