pub async fn subscribe_actions<F, Fut>(
rpc_endpoint: &str,
on_notification: F,
) -> Result<ActionSubscriptionHandle, SubscriptionError>Expand description
Subscribe to scheduled-action results streamed over actionSubscribe.
The session automatically runs the ScheduledActions registered at creation;
each result is delivered to on_notification as an ActionResultNotification.
This is a single, keyless subscription — every action shares one stream, so the
callback distinguishes them via action_index / label.
A websocket disconnect is treated as a fatal error — the handle’s join_handle
resolves with a SubscriptionRuntimeError.
§Example
use simulator_client::subscribe_actions;
let handle = subscribe_actions(
"http://localhost:8900/session/abc",
|result| async move {
println!("slot={} label={:?}", result.slot, result.label);
},
)
.await?;
handle.stop.send(true).ok();
handle.join_handle.await.ok();