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 {