log ws close event

This commit is contained in:
Sebastian Hugentobler 2023-02-23 13:32:49 +01:00
parent 90f8bb67b3
commit 869efdd56a
Signed by: shu
GPG Key ID: BB32CF3CA052C2F0
2 changed files with 4 additions and 1 deletions

View File

@ -30,7 +30,8 @@ function setupUi() {
}
function setupWs() {
ws.onclose = function () {
ws.onclose = function (e) {
console.log(e);
setTimeout(() => {
ws = new WebSocket(wsUrl);
}, 2000);

View File

@ -56,6 +56,8 @@ async fn handle_socket(stream: WebSocket, state: Arc<AppState>) {
while let Some(Ok(Message::Text(text))) = receiver.next().await {
if let Ok(action) = serde_json::from_str::<Action>(&text) {
let client = action.client.clone();
tracing::debug!("update from {}", client.clone());
action.execute(state.clone()).await;
let doc = state.doc.read().await;