• Start

Languages

/

Mojo

/

Methods

live_query

The live_query() method for the SurrealDB Mojo SDK starts a live query on a table.

Starts a live query on a table and returns the query id as a string. Notifications arrive out of band and are queued by the transport; pull them out with poll_notifications().

Method Syntax

client.live_query(table, session)
ArgumentDescription
tableThe table to subscribe to.
sessionAn optional session id.
var query_id = client.live_query("person")

var notifications = client.poll_notifications()
for ref in notifications:
print(ref[].query_id, ref[].action)

To get the full RpcResponse instead of just the query id, use live_raw(table, session).

Was this page helpful?