pub fn subscribe(
client: &SonosClient,
ip: &str,
callback_url: &str,
) -> Result<ManagedSubscription>Expand description
Subscribe to RenderingControl events
This is a convenience function that subscribes to RenderingControl service events. Events include volume changes, mute state changes, etc.
§Arguments
client- The SonosClient to use for the subscriptionip- The IP address of the Sonos devicecallback_url- URL where the device will send event notifications
§Returns
A managed subscription for RenderingControl events
§Example
ⓘ
use sonos_api::{SonosClient, services::rendering_control};
let client = SonosClient::new();
let subscription = rendering_control::subscribe(
&client,
"192.168.1.100",
"http://192.168.1.50:8080/callback"
)?;
// Now RenderingControl events will be sent to your callback URL
// Execute control operations separately:
let vol_op = rendering_control::set_volume("Master".to_string(), 50).build()?;
client.execute("192.168.1.100", vol_op)?;