rally/runtime/effect

Page-side effects for navigation, theme preferences, and server-side broadcast fan-out.

Types

pub type Effect(a) =
  effect.Effect(a)

Values

pub fn broadcast_to_app(msg: a) -> effect.Effect(b)

Broadcast a message to every connection in the app.

pub fn broadcast_to_page(msg: a) -> effect.Effect(b)

Broadcast a message to all connections viewing the current page. Broadcasts via pg topics for other connections, plus push_outgoing_frame for the sender’s own connection (which isn’t subscribed to its own topic).

pub fn broadcast_to_session(msg: a) -> effect.Effect(b)

Broadcast a message to all connections in the current browser session.

pub fn get_ws_session() -> String

Get the session ID for the current WS connection.

pub fn navigate(path: String) -> effect.Effect(a)

Navigate to a new URL path. Pushes a new history entry and triggers Rally’s browser navigation listener. On the server, this is a no-op.

pub fn none() -> effect.Effect(a)
pub fn read_dark_mode() -> Bool

Read the dark mode preference from the cookie. Falls back to prefers-color-scheme media query. On the server, returns False.

pub fn read_lang() -> String

Read the language preference from the cookie. On the server, returns “en”.

pub fn send_to_client(msg: a) -> effect.Effect(b)

Queue a push frame for the current WebSocket connection.

pub fn set_dark_mode(enabled: Bool) -> effect.Effect(a)

Toggle dark mode. On the client, sets the cookie and toggles the class. On the server, this is a no-op.

pub fn set_lang(lang: String) -> effect.Effect(a)

Set the language preference cookie. On the server, this is a no-op.

Search Document