Skip to content

module

live

Data that keeps changing: timers, connections and what their messages do to a table. The browser supplies the actual timers and sockets through set_host, so all of this runs the same under test.

Modules

  • graphql_ws

    graphql-ws: how GraphQL subscriptions run over a WebSocket.

Structs

  • Cancel

    Stops something when dropped.

  • Connect

    Where and how to connect for live updates.

  • Connection

    An open connection: closes when dropped.

  • Host

    What only the browser can do.

Enums

  • LiveEvent

    What a connection reports.

  • Save

    A file for the visitor to keep.

  • Transport

    How a live source connects.

  • Update

    How a live message changes the data.

Functions

backoff_ms

pub fn backoff_ms(attempt: u32) -> f64

How long to wait before reconnecting: 1, 2, 4… seconds, at most 30.

host

pub fn host() -> Option<Host>

The browser's host, if one is set (none while prerendering).

parse_message

pub fn parse_message(spec: &Spec, text: &str) -> Option<Table>

Read a message into rows. A None is a message that isn't data, which a connection is free to send: pings, notices.

set_host

pub fn set_host(host: Host)

Set the host. A build has none, so nothing live starts while prerendering.

table_of

pub fn table_of(spec: &Spec, j: &Value) -> Result<Table, Error>

Rows from a message's JSON.