ezsockets integrated with cli startup

This commit is contained in:
Dave Hrycyszyn
2024-06-06 19:32:29 +01:00
parent ff9fbd49ec
commit 404a769259
3 changed files with 53 additions and 51 deletions

View File

@@ -10,7 +10,6 @@ use bft_json_crdt::{
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use websockets::WebSocket;
use crate::keys;
@@ -39,9 +38,9 @@ pub(crate) fn new(side_dir: PathBuf) -> (BaseCrdt<CrdtList>, Ed25519KeyPair) {
pub(crate) async fn send(
count: u32,
bft_crdt: &mut BaseCrdt<CrdtList>,
ws: &mut WebSocket,
// ws: &mut WebSocket,
keys: &Ed25519KeyPair,
) -> Result<(), websockets::WebSocketError> {
) {
// generate a placeholder transaction
let transaction = generate_transaction(count, keys.public().to_string());
@@ -53,9 +52,9 @@ pub(crate) async fn send(
.insert_idx(next - 1, transaction.clone())
.sign(&keys);
Ok(ws
.send_text(serde_json::to_string(&signed_op).unwrap())
.await?)
// Ok(ws
// .send_text(serde_json::to_string(&signed_op).unwrap())
// .await?)
}
fn generate_transaction(count: u32, pubkey: String) -> Value {