Initiate live queries for a live stream of notifications.
You can achieve the same live subscription by running LIVE SELECT inside query() and consuming results with IndexedResults::stream. This can be useful when one or more live statements are part of a larger batch or if you prefer to use raw SurrealQL.
Arguments
| Argument | Description |
|---|---|
resource
| The table name or a record ID to select. |
Example usage: Listen for live updates
The following example requires adding the futures crate with cargo add futures in order to work with the results of the async stream. Once run, the program will continue to wait and listen for events for the person table to happen.
Then connect to it using Surrealist or open a new terminal window with the following command.
You can then use queries like the following to work with some person records.
The following output will then show up in the terminal window running the Rust example.