pub struct Channel {
pub name: String,
/* private fields */
}Expand description
Represents a named realtime channel with broadcast capabilities.
Fields§
§name: StringChannel identifier name.
Implementations§
Source§impl Channel
impl Channel
Sourcepub fn new(name: impl Into<String>, capacity: usize) -> Self
pub fn new(name: impl Into<String>, capacity: usize) -> Self
Creates a new realtime channel with specified message queue capacity.
Sourcepub fn broadcast(
&self,
event: &str,
payload: &str,
) -> Result<usize, RealtimeError>
pub fn broadcast( &self, event: &str, payload: &str, ) -> Result<usize, RealtimeError>
Broadcasts an event and payload to all subscribed clients.
Sourcepub fn subscribe(&self) -> Receiver<RealtimeMessage>
pub fn subscribe(&self) -> Receiver<RealtimeMessage>
Subscribes to messages broadcasted on this channel.
Auto Trait Implementations§
impl Freeze for Channel
impl RefUnwindSafe for Channel
impl Send for Channel
impl Sync for Channel
impl Unpin for Channel
impl UnsafeUnpin for Channel
impl UnwindSafe for Channel
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