Do you mean for Kotlin? I would say yes, but this will bring back the maintainability "issues" on my side.

If you need just a basic blocking client I could help to write and integrate it in your project, but you'll have to maintain it by yourself. It can be extended/adjusted depending on your project needs.

Just to know, are there problems with async version in kotlin? Do it increase code complexity?

Reply to this note

Please Login to reply.

Discussion

I mean Rust.

Ahh ok. I'll think about that. But it's pretty easy to write a blocking wrapper, including only the stuff you need. This could be a solution for your above request:

```toml

[dependencies]

nostr-sdk = "0.36"

tokio = { version = "1.41", features = ["full"] }

```

```rust

use std::sync::LazyLock;

use nostr_sdk::prelude::*;

use tokio::runtime::Runtime;

static RUNTIME: LazyLock = LazyLock::new(|| Runtime::new().unwrap());

pub struct ClientBlocking {

inner: Client,

}

impl ClientBlocking {

pub fn add_relay(&self, url: &str) -> Result {

RUNTIME.block_on(async {

Ok(self.inner.add_relay(url).await?)

})

}

pub fn connect(&self) {

RUNTIME.block_on(async {

self.inner.connect().await

})

}

pub fn send_event(&self, event: Event) -> Result> {

RUNTIME.block_on(async {

Ok(self.inner.send_event(event).await?)

})

}

pub fn subscribe(&self, filters: Vec) -> Result> {

RUNTIME.block_on(async {

Ok(self.inner.subscribe(filters, None).await?)

})

}

pub fn handle_notifications(&self, func: F) -> Result<()>

where

F: Fn(RelayPoolNotification) -> Result,

{

let mut notifications = self.inner.notifications();

while let Ok(notification) = RUNTIME.block_on(notifications.recv()) {

let shutdown: bool = RelayPoolNotification::Shutdown == notification;

let exit: bool = func(notification)?;

if exit || shutdown {

break;

}

}

Ok(())

}

}

```