gizweb:presence
Who is in a room now: each person renews a lease with a heartbeat, and a person whose lease ended is gone.
import * as Presence from "gizweb:presence";Types
Presence
type Presence = { @Key room: string; @Key person: string; expires: i64; }PERSON's lease in ROOM, which ends at expires (ms).
room:stringperson:stringexpires:i64
Functions
install
function install(d: Data.Db): bool throws Model.RejectionMakes the presence table when it is not there.
Effects: fail, read, write, console, io.
beat
function beat(d: Data.Db, room: string, person: string, expires: i64): bool throws Model.RejectionRenews PERSON's lease in ROOM until EXPIRES.
Effects: fail, read, write, console, io.
present
function present(d: Data.Db, room: string, now: i64): Vec<string> throws Model.RejectionThe people in ROOM at NOW, ordered by id.
Effects: fail, read, write, console, io.