remove duplicate filter types

only use nostrdb::Filter

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-08-04 10:40:59 -07:00
parent 8c458f8f78
commit 9328ef2dff
18 changed files with 156 additions and 225 deletions

View File

@@ -1,9 +1,10 @@
use ewebsock::{WsMessage, WsReceiver, WsSender};
use crate::{ClientMessage, Filter, Result};
use log::info;
use crate::{ClientMessage, Result};
use nostrdb::Filter;
use std::fmt;
use std::hash::{Hash, Hasher};
use tracing::{debug, error, info};
pub mod message;
pub mod pool;
@@ -60,7 +61,18 @@ impl Relay {
}
pub fn send(&mut self, msg: &ClientMessage) {
let txt = WsMessage::Text(msg.to_json());
let json = match msg.to_json() {
Ok(json) => {
debug!("sending {} to {}", json, self.url);
json
}
Err(e) => {
error!("error serializing json for filter: {e}");
return;
}
};
let txt = WsMessage::Text(json);
self.sender.send(txt);
}