pub struct Relay { /* private fields */ }Expand description
Relay
Implementations§
source§impl Relay
impl Relay
sourcepub fn new(
url: Url,
pool_sender: Sender<RelayPoolMessage>,
notification_sender: Sender<RelayPoolNotification>,
proxy: Option<SocketAddr>,
opts: RelayOptions
) -> Self
pub fn new( url: Url, pool_sender: Sender<RelayPoolMessage>, notification_sender: Sender<RelayPoolNotification>, proxy: Option<SocketAddr>, opts: RelayOptions ) -> Self
Create new Relay
sourcepub fn proxy(&self) -> Option<SocketAddr>
pub fn proxy(&self) -> Option<SocketAddr>
Get proxy
sourcepub async fn status(&self) -> RelayStatus
pub async fn status(&self) -> RelayStatus
Get RelayStatus
sourcepub async fn document(&self) -> RelayInformationDocument
pub async fn document(&self) -> RelayInformationDocument
sourcepub async fn subscription(&self) -> ActiveSubscription
pub async fn subscription(&self) -> ActiveSubscription
sourcepub async fn update_subscription_filters(&self, filters: Vec<Filter>)
pub async fn update_subscription_filters(&self, filters: Vec<Filter>)
Update ActiveSubscription
sourcepub fn opts(&self) -> RelayOptions
pub fn opts(&self) -> RelayOptions
Get RelayOptions
sourcepub fn stats(&self) -> RelayConnectionStats
pub fn stats(&self) -> RelayConnectionStats
sourcepub async fn connect(&self, wait_for_connection: bool)
pub async fn connect(&self, wait_for_connection: bool)
Connect to relay and keep alive connection
sourcepub async fn terminate(&self) -> Result<(), Error>
pub async fn terminate(&self) -> Result<(), Error>
Disconnect from relay and set status to ‘Terminated’
sourcepub async fn send_msg(
&self,
msg: ClientMessage,
wait: bool
) -> Result<(), Error>
pub async fn send_msg( &self, msg: ClientMessage, wait: bool ) -> Result<(), Error>
Send msg to relay
if wait arg is true, this method will wait for the msg to be sent
sourcepub async fn subscribe(
&self,
filters: Vec<Filter>,
wait: bool
) -> Result<SubscriptionId, Error>
pub async fn subscribe( &self, filters: Vec<Filter>, wait: bool ) -> Result<SubscriptionId, Error>
Subscribe
sourcepub async fn get_events_of_with_callback<F>(
&self,
filters: Vec<Filter>,
timeout: Option<Duration>,
callback: impl Fn(Event) -> F
) -> Result<(), Error>where
F: Future<Output = ()>,
pub async fn get_events_of_with_callback<F>( &self, filters: Vec<Filter>, timeout: Option<Duration>, callback: impl Fn(Event) -> F ) -> Result<(), Error>where F: Future<Output = ()>,
Get events of filters with custom callback
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Relay
impl Send for Relay
impl Sync for Relay
impl Unpin for Relay
impl !UnwindSafe for Relay
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more