Skip to main content

EventSubscription

Namespace: IotaSdk

A live subscription.

Call next in a loop to receive updates; it only returns None once cancel has been called, since the subscription itself never ends.

public class EventSubscription : IEventSubscription, System.IDisposable

Inheritance Object → EventSubscription
Implements IEventSubscription, IDisposable

Constructors​

EventSubscription(UInt64)​

public EventSubscription(ulong pointer)

Parameters​

pointer UInt64

Methods​

Destroy()​

public void Destroy()

Dispose()​

public void Dispose()

Cancel()​

Cancel the subscription, dropping the connection and unblocking a pending next.

Idempotent, and safe to call while next is pending — the pending call drops the connection on its way out.

Named cancel rather than close because a close method collides with the disposal method uniffi generates for objects in some languages.

public void Cancel()

IsCanceled()​

Whether the subscription has been canceled.

public bool IsCanceled()

Returns​

Boolean

Next()​

Wait for the next update.

Returns None once the subscription has been canceled. Concurrent calls are serialized; there is no ordering guarantee between them.

Raises for errors the subscription cannot recover from by itself, such as a rejected filter. The subscription stays usable afterwards, so a caller that considers the error transient can keep calling next.

public async Task<EventUpdate?> Next()

Returns​

Task<EventUpdate>

Exceptions​

SdkFfiException