Going back to blocking, need a new thread here

This commit is contained in:
Dave Hrycyszyn
2024-06-10 14:26:00 +01:00
parent 4717ffa7e8
commit 91fbe7f9bd

View File

@@ -1,8 +1,7 @@
use async_trait::async_trait;
use bft_json_crdt::json_crdt::SignedOp;
use ezsockets::ClientConfig;
use tokio::fs::File;
use tokio::io;
use std::io::BufRead;
use tokio::sync::mpsc;
use crate::{node::SideNode, utils};
@@ -25,11 +24,10 @@ impl WebSocketClient {
tokio::spawn(async move {
future.await.unwrap();
});
let stdin = tokio::io::stdin();
// let lines = stdin.lock().lines();
//
let mut reader = FramedRead::new(stdin, LinesCodec::new());
let line = reader.next().await.transpose()?.unwrap();
let stdin = std::io::stdin();
let lines = stdin.lock().lines();
for line in lines {
let line = line.unwrap();
let signed_op = if let "exit" = line.as_str() {
break;
} else if let "trace" = line.as_str() {
@@ -43,6 +41,7 @@ impl WebSocketClient {
let json = serde_json::to_string(&signed_op).unwrap();
handle.text(json).unwrap();
}
}
}
#[async_trait]