Skip to main content

Class: EventSubscription

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.

Extends​

  • UniffiAbstractObject

Implements​

Properties​

[destructorGuardSymbol]​

readonly [destructorGuardSymbol]: UniffiGcObject;

[pointerLiteralSymbol]​

readonly [pointerLiteralSymbol]: bigint;

[uniffiTypeNameSymbol]​

readonly [uniffiTypeNameSymbol]: "EventSubscription" = "EventSubscription";

Methods​

cancel()​

cancel(): void;

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.

Returns​

void

Implementation of​

EventSubscriptionLike.cancel


isCanceled()​

isCanceled(): boolean;

Whether the subscription has been canceled.

Returns​

boolean

Implementation of​

EventSubscriptionLike.isCanceled


next()​

next(asyncOpts_?): Promise<EventUpdate | undefined>;

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.

Parameters​

asyncOpts_?​
signal​

AbortSignal

Returns​

Promise<EventUpdate | undefined>

Implementation of​

EventSubscriptionLike.next


uniffiDestroy()​

uniffiDestroy(): void;

Explicitly tell Rust to destroy the native peer that backs this object.

Once this method has been called, any following method calls will throw an error.

Can be called more than once.

Returns​

void

Overrides​

UniffiAbstractObject.uniffiDestroy

uniffiUse()​

uniffiUse<T>(block): T;

A convenience method to use this object, then destroy it after its use.

Type Parameters​

T​

T

Parameters​

block​

(obj) => T

Returns​

T

Inherited from​

UniffiAbstractObject.uniffiUse

instanceOf()​

static instanceOf(obj_): obj_ is EventSubscription;

Parameters​

obj_​

any

Returns​

obj_ is EventSubscription