Skip to main content

Crate rok_broadcasting

Crate rok_broadcasting 

Source
Expand description

rok-broadcasting — Laravel Echo-compatible real-time channel broadcasting.

Provides public, private, and presence channels backed by an in-process broadcast bus. Pair with a WebSocket layer (e.g. rok-websocket) or a dedicated pusher-compatible server to deliver events to clients.

§Quick start

use rok_broadcasting::Broadcasting;

// Public channel
Broadcasting::channel("orders")
    .to_user(user_id)
    .emit("order.shipped", &payload)
    .await?;

// Private channel
let ch = Broadcasting::private_channel("inbox.42");
ch.emit("message.new", &msg).await?;

// Presence channel
let ch = Broadcasting::presence_channel("room.1");
ch.join(user_id, &meta).await?;
ch.emit("user.joined", &meta).await?;

Re-exports§

pub use channel::BroadcastChannel;
pub use channel::ChannelKind;
pub use driver::BroadcastDriver;
pub use driver::InMemoryDriver;
pub use error::BroadcastError;
pub use event::BroadcastEvent;
pub use presence::PresenceChannel;

Modules§

channel
driver
error
event
presence

Structs§

Broadcasting
Static facade — entry point for all broadcasting operations.

Functions§

set_driver
Set the global broadcast driver. Call once at startup before using Broadcasting.