From 869efdd56aa3d59a38e2e5f618e767b4308d0a60 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Thu, 23 Feb 2023 13:32:49 +0100 Subject: [PATCH] log ws close event --- assets/index.js | 3 ++- src/ws.rs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/assets/index.js b/assets/index.js index 5c89024..12fd160 100644 --- a/assets/index.js +++ b/assets/index.js @@ -30,7 +30,8 @@ function setupUi() { } function setupWs() { - ws.onclose = function () { + ws.onclose = function (e) { + console.log(e); setTimeout(() => { ws = new WebSocket(wsUrl); }, 2000); diff --git a/src/ws.rs b/src/ws.rs index 392aa9d..5b40644 100644 --- a/src/ws.rs +++ b/src/ws.rs @@ -56,6 +56,8 @@ async fn handle_socket(stream: WebSocket, state: Arc) { while let Some(Ok(Message::Text(text))) = receiver.next().await { if let Ok(action) = serde_json::from_str::(&text) { let client = action.client.clone(); + tracing::debug!("update from {}", client.clone()); + action.execute(state.clone()).await; let doc = state.doc.read().await;