class MySubscriber: SudoSubscriber {
func sudoChanged(changeType: SudoChangeType, sudo: Sudo) {
// Process new, updated or deleted Sudo.
func connectionStatusChanged(state: SubscriptionConnectionState) {
// The subscription is now connected hence the subscribers
// will start receiving Sudo changes.
} else if state == .disconnected {
// The subscription is disconnected and all subscribers were
// automatically unsubscribed. Subscribe again to establish a
// new connection or report the error.
let subscriber = MySubscriber()
try await self.client.subscribe(id: "subscriber_id", changeType: .create, subscriber: subscriber)
// Handle error. An error might be thrown for unrecoverable circumstances arising
// from programmatic error or configuration error. For example, if the keychain
// access entitlement is not set up correctly, the client is not signed in,
// or basic system resources are unavailable.