Struct puff_rs::databases::pubsub::PubSubClient
source · pub struct PubSubClient { /* private fields */ }Expand description
A client to work with PubSub. A pubsub client currently is assumed to be alive for the lifetime of a program and maintains a single persistent connection to Redis.
PubSubConnections do not create new Redis connections instead share the same one and the client broadcasts new messages over unbounded channels.
Implementations
sourceimpl PubSubClient
impl PubSubClient
pub fn start_supervised_listener(&self)
sourcepub fn connection_with_id(
&self,
connection_id: ConnectionId
) -> PuffResult<(PubSubConnection, UnboundedReceiver<PubSubMessage>)>
pub fn connection_with_id(
&self,
connection_id: ConnectionId
) -> PuffResult<(PubSubConnection, UnboundedReceiver<PubSubMessage>)>
Create a connection that can subscribe to channels with a specific ConnectionId
sourcepub fn connection(
&self
) -> PuffResult<(PubSubConnection, UnboundedReceiver<PubSubMessage>)>
pub fn connection(
&self
) -> PuffResult<(PubSubConnection, UnboundedReceiver<PubSubMessage>)>
Create a connection that can subscribe to channels.
sourcepub fn new_connection_id(&self) -> ConnectionId
pub fn new_connection_id(&self) -> ConnectionId
Generate a new connection ID
sourcepub fn publish_as<T: Into<Text>, M: Into<Bytes>>(
&self,
connection_id: ConnectionId,
channel: T,
body: M
) -> BoxFuture<'_, PuffResult<()>>
pub fn publish_as<T: Into<Text>, M: Into<Bytes>>(
&self,
connection_id: ConnectionId,
channel: T,
body: M
) -> BoxFuture<'_, PuffResult<()>>
Try to broadcast a message to the channel.
Trait Implementations
sourceimpl Clone for PubSubClient
impl Clone for PubSubClient
sourcefn clone(&self) -> PubSubClient
fn clone(&self) -> PubSubClient
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl Puff for PubSubClient
impl Puff for PubSubClient
Auto Trait Implementations
impl !RefUnwindSafe for PubSubClient
impl Send for PubSubClient
impl Sync for PubSubClient
impl Unpin for PubSubClient
impl !UnwindSafe for PubSubClient
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more