use bft_json_crdt::keypair::Ed25519KeyPair; use tokio::time::{self}; use websockets::WebSocket; /// Starts a websocket and periodically sends a BFT-CRDT message to the websocket server pub(crate) async fn start(keys: Ed25519KeyPair) -> Result<(), websockets::WebSocketError> { let mut ws = WebSocket::connect("ws://localhost:8080/").await?; let mut interval = time::interval(time::Duration::from_secs(2)); loop { interval.tick().await; println!("Sending: period"); ws.send_text("period".to_string()).await?; let msg = ws.receive().await?; println!("Received: {:?}", msg); } }