# ILiveVoiceSideband

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.ilivevoicesideband/
> Summary: ILiveVoiceSideband: The server-side control connection of a live voice session.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Abstractions.dll</code></div>

The server-side control connection of a live voice session.

```csharp
public interface ILiveVoiceSideband : IAsyncDisposable
```

<dl class="api-relations"><dt>Implements</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.iasyncdisposable">IAsyncDisposable</a></dd></dl>

## Remarks

**Lifetime:** never resolved from dependency injection, so neither
`singleton`, `scoped` nor `transient` describes it. One instance
belongs to one session, is produced by
[ILiveVoiceProvider.AttachSessionAsync](/api/tracon.ilivevoiceprovider/#Tracon_ILiveVoiceProvider_AttachSessionAsync_Tracon_LiveVoiceAttachRequest_System_Threading_CancellationToken_), and is disposed when that session
ends. [ILiveVoiceSideband.AppendAsync](/api/tracon.ilivevoicesideband/#Tracon_ILiveVoiceSideband_AppendAsync_Tracon_LiveVoiceAppend_System_Threading_CancellationToken_) may be called concurrently by several delegations,
so an implementation serializes its writes; [ILiveVoiceSideband.ReceiveAsync](/api/tracon.ilivevoicesideband/#Tracon_ILiveVoiceSideband_ReceiveAsync_System_Threading_CancellationToken_) is consumed
by a single pump.

**Tenant:** `tenant-independent`. The connection carries no
tenant of its own — the caller establishes the session's tenant before the first
event is handled, and every run the delegations produce inherits it from there.

**Delivery:** `best-effort` in both directions. An append that
the provider refuses is reported, not retried, because a retried append can make
the model say the same sentence twice; and the event stream ends when the socket
does, with no replay of what was missed.

There is deliberately no `InterruptAsync`: the provider surface offers no way
for the sideband to stop the model mid-sentence. Should one appear, it is added as
a new [LiveVoiceAppendChannel](/api/tracon.livevoiceappendchannel/) value rather than as a new interface
member, so the record and the enum grow while the interface does not.

**Disposal races the pump.** The host may call [IAsyncDisposable.DisposeAsync](https://learn.microsoft.com/dotnet/api/system.iasyncdisposable)
from a caller-initiated close while the single pump described above still has an
outstanding [ILiveVoiceSideband.ReceiveAsync](/api/tracon.ilivevoicesideband/#Tracon_ILiveVoiceSideband_ReceiveAsync_System_Threading_CancellationToken_) call in flight — closing a session does not
wait for the pump to notice first. An implementation over a transport with its own
two-way close (a `ClientWebSocket`, for one) must not call that two-way close
from its own dispose: it typically reads as part of completing the close
handshake, and a second, concurrent reader racing the pump's own read can consume a
message the pump never sees, even though the two-way call itself reports success.
Send a one-way close signal instead (`CloseOutputAsync` on a
`ClientWebSocket`) and let the pump's own loop end on its own — only tearing
the transport down once that loop has actually finished, bounded by a timeout for a
peer that never acknowledges.

## Methods

### <a id="Tracon_ILiveVoiceSideband_AppendAsync_Tracon_LiveVoiceAppend_System_Threading_CancellationToken_"></a> AppendAsync\(LiveVoiceAppend, CancellationToken\)

Sends text into the live conversation's context.

```csharp
ValueTask AppendAsync(LiveVoiceAppend append, CancellationToken cancellationToken = default)
```

#### Parameters

`append` [LiveVoiceAppend](/api/tracon.livevoiceappend/)

The channel, the delegation and the text.

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

The cancellation token.

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask)

The completion task.

### <a id="Tracon_ILiveVoiceSideband_ReceiveAsync_System_Threading_CancellationToken_"></a> ReceiveAsync\(CancellationToken\)

Reads the session's events until the session closes.

```csharp
IAsyncEnumerable<LiveVoiceEvent> ReceiveAsync(CancellationToken cancellationToken = default)
```

#### Parameters

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

The cancellation token.

#### Returns

 [IAsyncEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable\-1)<[LiveVoiceEvent](/api/tracon.livevoiceevent/)\>

The event stream.
