Consuming SignedOp when it's handled
This commit is contained in:
@@ -37,6 +37,8 @@ impl ezsockets::ClientExt for WebSocketClient {
|
||||
// match on it.
|
||||
type Call = String;
|
||||
|
||||
/// When we receive a text message, apply the crdt operation contained in it to our
|
||||
/// local crdt.
|
||||
async fn on_text(&mut self, text: String) -> Result<(), ezsockets::Error> {
|
||||
tracing::info!("received text: {text:?}");
|
||||
let incoming: bft_json_crdt::json_crdt::SignedOp = serde_json::from_str(&text).unwrap();
|
||||
@@ -44,11 +46,14 @@ impl ezsockets::ClientExt for WebSocketClient {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// When we receive a binary message, log the bytes. Currently unused.
|
||||
async fn on_binary(&mut self, bytes: Vec<u8>) -> Result<(), ezsockets::Error> {
|
||||
tracing::info!("received bytes: {bytes:?}");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Call this with the `Call` type to send application data to the websocket client
|
||||
/// (and from there, to the server).
|
||||
async fn on_call(&mut self, call: Self::Call) -> Result<(), ezsockets::Error> {
|
||||
tracing::info!("sending signed op: {call:?}");
|
||||
self.handle.text(call)?;
|
||||
|
||||
Reference in New Issue
Block a user