pub struct AsyncSubscriber { /* private fields */ }Expand description
Subscribed async TCP-RESP connection. Mirrors
[kevy_client::Subscriber] for TCP backends.
Implementations§
Source§impl AsyncSubscriber
impl AsyncSubscriber
Sourcepub async fn connect(url: &str) -> Result<Self>
pub async fn connect(url: &str) -> Result<Self>
Open a fresh connection without subscribing yet. Call
Self::subscribe / Self::psubscribe next.
Sourcepub async fn open(url: &str, channels: &[&[u8]]) -> Result<Self>
pub async fn open(url: &str, channels: &[&[u8]]) -> Result<Self>
Open and subscribe to one or more channels in one step.
Sourcepub async fn subscribe(&mut self, channels: &[&[u8]]) -> Result<()>
pub async fn subscribe(&mut self, channels: &[&[u8]]) -> Result<()>
SUBSCRIBE channel [channel ...]. Per-channel Subscribe acks
arrive via Self::recv.
Sourcepub async fn psubscribe(&mut self, patterns: &[&[u8]]) -> Result<()>
pub async fn psubscribe(&mut self, patterns: &[&[u8]]) -> Result<()>
PSUBSCRIBE pattern [pattern ...].
Sourcepub async fn unsubscribe(&mut self, channels: &[&[u8]]) -> Result<()>
pub async fn unsubscribe(&mut self, channels: &[&[u8]]) -> Result<()>
UNSUBSCRIBE [channel ...]. Empty list = unsubscribe all.
Sourcepub async fn punsubscribe(&mut self, patterns: &[&[u8]]) -> Result<()>
pub async fn punsubscribe(&mut self, patterns: &[&[u8]]) -> Result<()>
PUNSUBSCRIBE [pattern ...]. Empty list = unsubscribe all.
Sourcepub async fn recv(&mut self) -> Result<PubsubEvent>
pub async fn recv(&mut self) -> Result<PubsubEvent>
Await the next pubsub frame. Connection close = UnexpectedEof.
Sourcepub async fn recv_message(&mut self) -> Result<(Vec<u8>, Vec<u8>)>
pub async fn recv_message(&mut self) -> Result<(Vec<u8>, Vec<u8>)>
Skip subscription-ack frames and return the next published
Message / Pmessage. Returns (channel, payload); for
pattern matches channel is the concrete publish channel
(the matched pattern is discarded — use Self::recv if you
need it).
Sourcepub async fn hello3(&mut self) -> Result<PubsubEvent>
pub async fn hello3(&mut self) -> Result<PubsubEvent>
Negotiate RESP3 on this connection (HELLO 3). Must run BEFORE
any subscribe — Redis spec requires HELLO be the first command.
Returns a synthetic PubsubEvent::Subscribe marker (matching
the blocking client) so callers can pattern-match a uniform
type.