Table of Contents

Method AddSubAsync

Namespace
NATS.Client.Core
Assembly
NATS.Client.Core.dll

AddSubAsync(NatsSubBase, CancellationToken)

Adds a subscription to the NATS connection for a given NatsSubBase object. Subscriptions are managed by the connection and are automatically removed when the connection is closed.

public ValueTask AddSubAsync(NatsSubBase sub, CancellationToken cancellationToken = default)

Parameters

sub NatsSubBase

The NatsSubBase object representing the subscription details.

cancellationToken CancellationToken

A CancellationToken used to cancel the operation.

Returns

ValueTask

A ValueTask that represents the asynchronous subscription operation.