From 98da8b95d5e47d6732ea216337c1b7b48ff9537f Mon Sep 17 00:00:00 2001 From: mattbk Date: Sun, 12 Oct 2025 21:06:49 -0500 Subject: [PATCH] Send a UDP message to the server that says you are connected. --- src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 986f45f..5211c97 100644 --- a/src/main.rs +++ b/src/main.rs @@ -406,6 +406,7 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager) { "summary": &summary, "text": &text, "timestamp": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs(), + "type": "data" }); let _ = socket.expect("REASON").send_to(packet.to_string().as_bytes(), uaddr); } @@ -437,8 +438,13 @@ fn main() -> Result<()> { let socket = UdpSocket::bind("0.0.0.0:0")?; println!("UDP client started at {}:{}", cli.uip, cli.uport); // Send a message to the server - let message = "UDP client connected"; - socket.send_to(message.as_bytes(), uaddr)?; + let packet = json!({ + "text": "UDP client connected", + "timestamp": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs(), + "type": "status" + }); + //let message = "UDP client connected"; + socket.send_to(packet.to_string().as_bytes(), uaddr)?; } loop {