We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the enhancement Same as NDK https://github.com/nostr-dev-kit/ndk#groupable-queries
Use case Prevent rate-limited by relays when load user's metadata or other metadata events from difference UI at the same time.
The text was updated successfully, but these errors were encountered:
In case anyone need a example for grouped query for Tauri app, I've made a simple function like this
app.listen_any("request_metadata", move |event| { let payload = event.payload(); let parsed_payload: Payload = serde_json::from_str(payload).expect("Parse failed"); let handle = handle_clone_child.clone(); tauri::async_runtime::spawn(async move { let state = handle.state::<Nostr>(); let client = &state.client; if let Ok(public_key) = PublicKey::parse(parsed_payload.id) { let mut write_queue = state.queue.write().await; write_queue.insert(public_key); }; // Wait for [QUEUE_DELAY] sleep(Duration::from_millis(QUEUE_DELAY)).await; let read_queue = state.queue.read().await; if !read_queue.is_empty() { let authors: HashSet<PublicKey> = read_queue.iter().copied().collect(); let filter = Filter::new() .authors(authors) .kind(Kind::Metadata) .limit(200); let opts = SubscribeAutoCloseOptions::default() .filter(FilterOptions::WaitDurationAfterEOSE(Duration::from_secs(3))); // Drop queue, you don't need it at this time anymore drop(read_queue); // Clear queue let mut write_queue = state.queue.write().await; write_queue.clear(); if let Ok(output) = client.subscribe(vec![filter], Some(opts)).await { println!("Subscribe success: {:?}", output.success); } } }); }); // Handle notification ... if let Err(e) = handle_clone.emit("metadata", event.as_json()) { println!("Emit error: {}", e) } ...
Sorry, something went wrong.
No branches or pull requests
Describe the enhancement
Same as NDK https://github.com/nostr-dev-kit/ndk#groupable-queries
Use case
Prevent rate-limited by relays when load user's metadata or other metadata events from difference UI at the same time.
The text was updated successfully, but these errors were encountered: