Skip to content

Commit

Permalink
feat: Send timestamp with pong
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed May 24, 2024
1 parent 511ce95 commit cbb1415
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition = "2021"

[dependencies]
async-recursion = "1.1.1"
chrono = "0.4.38"
clap = "4.5.4"
dunce = "1.0.4"
rpassword = "7.3.1"
Expand Down
2 changes: 2 additions & 0 deletions src/handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ pub async fn handle(connection: &mut server::Connection, json: &str) {

/// Ping pong
mod ping {
use chrono;
use crate::server;

pub async fn handle(connection: &mut server::Connection, json: &serde_json::Value) {
tracing::trace!("method: {:?}", json["method"]);
connection
.send(serde_json::json!({
"method": "pong",
"timestamp": chrono::offset::Local::now().to_string(),
}))
.await;
}
Expand Down

0 comments on commit cbb1415

Please sign in to comment.