You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mod tests {
use super::*;
use tendermint_rpc::{WebSocketClient, SubscriptionClient, Client};
use tendermint_rpc::query::EventType;
use futures::StreamExt;
#[tokio::test]
async fn test_ws() {
let (client, driver) = WebSocketClient::new("wss://rpc-osmosis.keplr.app/websocket")
.await
.unwrap();
let driver_handle = tokio::spawn(async move { driver.run().await });
// Standard client functionality
// let tx = format!("some-key=some-value");
// client.broadcast_tx_async(Transaction::from(tx.into_bytes())).await.unwrap();
// Subscription functionality
let mut subs = client.subscribe(EventType::NewBlock.into())
.await
.unwrap();
// Grab 5 NewBlock events
let mut ev_count = 5_i32;
while let Some(res) = subs.next().await {
let ev = res.unwrap();
println!("Got event: {:?}", ev);
ev_count -= 1;
if ev_count < 0 {
break;
}
}
// Signal to the driver to terminate.
client.close().unwrap();
// Await the driver's termination to ensure proper connection closure.
let _ = driver_handle.await.unwrap();
}
}
Steps to reproduce
Definition of "done"
The text was updated successfully, but these errors were encountered:
What went wrong?
#[cfg(test)]mod tests {
use super::*;
use tendermint_rpc::{WebSocketClient, SubscriptionClient, Client};
use tendermint_rpc::query::EventType;
use futures::StreamExt;
// let tx = format!("some-key=some-value");
// client.broadcast_tx_async(Transaction::from(tx.into_bytes())).await.unwrap();
}
Steps to reproduce
Definition of "done"
The text was updated successfully, but these errors were encountered: