Function spacetimedb_sdk::subscribe

source ·
pub fn subscribe(queries: &[&str]) -> Result<()>
Expand description

Subscribe to a set of queries, to be notified when rows which match those queries are altered.

The queries should be a slice of strings representing SQL queries.

A new call to subscribe (or subscribe_owned) will remove all previous subscriptions and replace them with the new queries. If any rows matched the previous subscribed queries but do not match the new queries, those rows will be removed from the client cache, and TableType::on_delete callbacks will be invoked for them.

subscribe will return an error if called before establishing a connection with the autogenerated connect function. In that case, the queries are not registered.