Adding async publish to relay pool

This commit is contained in:
2025-10-09 09:19:11 -04:00
parent c0784fc890
commit 45fb6d061d
12 changed files with 929 additions and 1626 deletions

View File

@@ -16,7 +16,7 @@ This document describes the public API for the Nostr Relay Pool implementation i
| [`nostr_relay_pool_poll()`](nostr_core/core_relay_pool.c:1232) | Single iteration poll and dispatch |
| [`nostr_relay_pool_query_sync()`](nostr_core/core_relay_pool.c:695) | Synchronous query returning event array |
| [`nostr_relay_pool_get_event()`](nostr_core/core_relay_pool.c:825) | Get single most recent event |
| [`nostr_relay_pool_publish()`](nostr_core/core_relay_pool.c:866) | Publish event and wait for OK responses |
| [`nostr_relay_pool_publish_async()`](nostr_core/core_relay_pool.c:866) | Publish event with async callbacks |
| [`nostr_relay_pool_get_relay_status()`](nostr_core/core_relay_pool.c:944) | Get connection status for a relay |
| [`nostr_relay_pool_list_relays()`](nostr_core/core_relay_pool.c:960) | List all relays and their statuses |
| [`nostr_relay_pool_get_relay_stats()`](nostr_core/core_relay_pool.c:992) | Get detailed statistics for a relay |
@@ -438,9 +438,9 @@ int get_latest_note_from_pubkey(nostr_relay_pool_t* pool, const char* pubkey_hex
```
### Publish Event
**Function:** [`nostr_relay_pool_publish()`](nostr_core/core_relay_pool.c:866)
**Function:** [`nostr_relay_pool_publish_async()`](nostr_core/core_relay_pool.c:866)
```c
int nostr_relay_pool_publish(
int nostr_relay_pool_publish_async(
nostr_relay_pool_t* pool,
const char** relay_urls,
int relay_count,
@@ -471,8 +471,8 @@ int publish_text_note(nostr_relay_pool_t* pool, const char* content) {
printf("Publishing note: %s\n", content);
int success_count = nostr_relay_pool_publish(
pool, relay_urls, 3, event);
int success_count = nostr_relay_pool_publish_async(
pool, relay_urls, 3, event, my_callback, user_data);
cJSON_Delete(event);