pub struct PubsubClient {}Expand description
A client for subscribing to messages from the RPC server.
See the module documentation.
Implementations§
Source§impl PubsubClient
impl PubsubClient
Sourcepub fn account_subscribe<R>(
request: R,
pubkey: &Address,
config: Option<RpcAccountInfoConfig>,
) -> Result<(PubsubClientSubscription<Response<UiAccount>>, Receiver<Response<UiAccount>>), PubsubClientError>where
R: IntoClientRequest,
pub fn account_subscribe<R>(
request: R,
pubkey: &Address,
config: Option<RpcAccountInfoConfig>,
) -> Result<(PubsubClientSubscription<Response<UiAccount>>, Receiver<Response<UiAccount>>), PubsubClientError>where
R: IntoClientRequest,
Subscribe to account events.
Receives messages of type UiAccount when an account’s lamports or data changes.
§RPC Reference
This method corresponds directly to the accountSubscribe RPC method.
Sourcepub fn block_subscribe<R>(
request: R,
filter: RpcBlockSubscribeFilter,
config: Option<RpcBlockSubscribeConfig>,
) -> Result<(PubsubClientSubscription<Response<RpcBlockUpdate>>, Receiver<Response<RpcBlockUpdate>>), PubsubClientError>where
R: IntoClientRequest,
pub fn block_subscribe<R>(
request: R,
filter: RpcBlockSubscribeFilter,
config: Option<RpcBlockSubscribeConfig>,
) -> Result<(PubsubClientSubscription<Response<RpcBlockUpdate>>, Receiver<Response<RpcBlockUpdate>>), PubsubClientError>where
R: IntoClientRequest,
Subscribe to block events.
Receives messages of type RpcBlockUpdate when a block is confirmed or finalized.
This method is disabled by default. It can be enabled by passing
--rpc-pubsub-enable-block-subscription to agave-validator.
§RPC Reference
This method corresponds directly to the blockSubscribe RPC method.
Sourcepub fn logs_subscribe<R>(
request: R,
filter: RpcTransactionLogsFilter,
config: RpcTransactionLogsConfig,
) -> Result<(PubsubClientSubscription<Response<RpcLogsResponse>>, Receiver<Response<RpcLogsResponse>>), PubsubClientError>where
R: IntoClientRequest,
pub fn logs_subscribe<R>(
request: R,
filter: RpcTransactionLogsFilter,
config: RpcTransactionLogsConfig,
) -> Result<(PubsubClientSubscription<Response<RpcLogsResponse>>, Receiver<Response<RpcLogsResponse>>), PubsubClientError>where
R: IntoClientRequest,
Subscribe to transaction log events.
Receives messages of type RpcLogsResponse when a transaction is committed.
§RPC Reference
This method corresponds directly to the logsSubscribe RPC method.
Sourcepub fn program_subscribe<R>(
request: R,
pubkey: &Address,
config: Option<RpcProgramAccountsConfig>,
) -> Result<(PubsubClientSubscription<Response<RpcKeyedAccount>>, Receiver<Response<RpcKeyedAccount>>), PubsubClientError>where
R: IntoClientRequest,
pub fn program_subscribe<R>(
request: R,
pubkey: &Address,
config: Option<RpcProgramAccountsConfig>,
) -> Result<(PubsubClientSubscription<Response<RpcKeyedAccount>>, Receiver<Response<RpcKeyedAccount>>), PubsubClientError>where
R: IntoClientRequest,
Subscribe to program account events.
Receives messages of type RpcKeyedAccount when an account owned
by the given program changes.
§RPC Reference
This method corresponds directly to the programSubscribe RPC method.
Sourcepub fn vote_subscribe<R>(
request: R,
) -> Result<(PubsubClientSubscription<RpcVote>, Receiver<RpcVote>), PubsubClientError>where
R: IntoClientRequest,
pub fn vote_subscribe<R>(
request: R,
) -> Result<(PubsubClientSubscription<RpcVote>, Receiver<RpcVote>), PubsubClientError>where
R: IntoClientRequest,
Subscribe to vote events.
Receives messages of type RpcVote when a new vote is observed. These
votes are observed prior to confirmation and may never be confirmed.
This method is disabled by default. It can be enabled by passing
--rpc-pubsub-enable-vote-subscription to agave-validator.
§RPC Reference
This method corresponds directly to the voteSubscribe RPC method.
Sourcepub fn root_subscribe<R>(
request: R,
) -> Result<(PubsubClientSubscription<u64>, Receiver<u64>), PubsubClientError>where
R: IntoClientRequest,
pub fn root_subscribe<R>(
request: R,
) -> Result<(PubsubClientSubscription<u64>, Receiver<u64>), PubsubClientError>where
R: IntoClientRequest,
Subscribe to root events.
Receives messages of type Slot when a new root is set by the
validator.
§RPC Reference
This method corresponds directly to the rootSubscribe RPC method.
Sourcepub fn signature_subscribe<R>(
request: R,
signature: &Signature,
config: Option<RpcSignatureSubscribeConfig>,
) -> Result<(PubsubClientSubscription<Response<RpcSignatureResult>>, Receiver<Response<RpcSignatureResult>>), PubsubClientError>where
R: IntoClientRequest,
pub fn signature_subscribe<R>(
request: R,
signature: &Signature,
config: Option<RpcSignatureSubscribeConfig>,
) -> Result<(PubsubClientSubscription<Response<RpcSignatureResult>>, Receiver<Response<RpcSignatureResult>>), PubsubClientError>where
R: IntoClientRequest,
Subscribe to transaction confirmation events.
Receives messages of type RpcSignatureResult when a transaction
with the given signature is committed.
This is a subscription to a single notification. It is automatically cancelled by the server once the notification is sent.
§RPC Reference
This method corresponds directly to the signatureSubscribe RPC method.
Sourcepub fn slot_subscribe<R>(
request: R,
) -> Result<(PubsubClientSubscription<SlotInfo>, Receiver<SlotInfo>), PubsubClientError>where
R: IntoClientRequest,
pub fn slot_subscribe<R>(
request: R,
) -> Result<(PubsubClientSubscription<SlotInfo>, Receiver<SlotInfo>), PubsubClientError>where
R: IntoClientRequest,
Subscribe to slot events.
Receives messages of type SlotInfo when processing of a slot begins.
§RPC Reference
This method corresponds directly to the slotSubscribe RPC method.
Sourcepub fn slot_updates_subscribe<R>(
request: R,
handler: impl Fn(SlotUpdate) + Send + 'static,
) -> Result<PubsubClientSubscription<SlotUpdate>, PubsubClientError>where
R: IntoClientRequest,
pub fn slot_updates_subscribe<R>(
request: R,
handler: impl Fn(SlotUpdate) + Send + 'static,
) -> Result<PubsubClientSubscription<SlotUpdate>, PubsubClientError>where
R: IntoClientRequest,
Subscribe to slot update events.
Receives messages of type SlotUpdate when various updates to a slot occur.
Note that this method operates differently than other subscriptions:
instead of sending the message to a receiver on a channel, it accepts a
handler callback that processes the message directly. This processing
occurs on another thread.
§RPC Reference
This method corresponds directly to the slotUpdatesSubscribe RPC method.
Auto Trait Implementations§
impl Freeze for PubsubClient
impl RefUnwindSafe for PubsubClient
impl Send for PubsubClient
impl Sync for PubsubClient
impl Unpin for PubsubClient
impl UnsafeUnpin for PubsubClient
impl UnwindSafe for PubsubClient
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeSendSync for T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.