mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +00:00
implement session handling for unsubscribe in subxt-client (#242)
* implement session handling for unsubscribe in subxt-client Signed-off-by: Gregory Hill <gregorydhill@outlook.com> * update jsonrpsee to `v0.2.0-alpha.2` Closes #241 * use new jsonrpsee request message types in subxt client Signed-off-by: Gregory Hill <gregorydhill@outlook.com> Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
This commit is contained in:
+2
-3
@@ -195,9 +195,8 @@ impl<T: Runtime> ClientBuilder<T> {
|
||||
let url = self.url.as_deref().unwrap_or("ws://127.0.0.1:9944");
|
||||
if url.starts_with("ws://") || url.starts_with("wss://") {
|
||||
let mut config = WsConfig::with_url(&url);
|
||||
// max notifs per subscription capacity.
|
||||
config.max_subscription_capacity = 4096;
|
||||
RpcClient::WebSocket(WsClient::new(WsConfig::with_url(&url)).await?)
|
||||
config.max_notifs_per_subscription = 4096;
|
||||
RpcClient::WebSocket(WsClient::new(config).await?)
|
||||
} else {
|
||||
let client = HttpClient::new(url, HttpConfig::default())?;
|
||||
RpcClient::Http(Arc::new(client))
|
||||
|
||||
@@ -171,6 +171,7 @@ pub enum RpcClient {
|
||||
}
|
||||
|
||||
impl RpcClient {
|
||||
/// Start a JSON-RPC request.
|
||||
pub async fn request<T: DeserializeOwned>(
|
||||
&self,
|
||||
method: &str,
|
||||
@@ -186,6 +187,7 @@ impl RpcClient {
|
||||
}
|
||||
}
|
||||
|
||||
/// Start a JSON-RPC Subscription.
|
||||
pub async fn subscribe<T: DeserializeOwned>(
|
||||
&self,
|
||||
subscribe_method: &str,
|
||||
|
||||
Reference in New Issue
Block a user