RenderSenderControl class
Creates render senders and delivers render stream requests for a session; reached through
Session.RenderSenders.
Namespace: Quaternar.Qaros · Assembly: Quaternar.Qaros.dll
public sealed class RenderSenderControl
Methods
| Member | Description |
|---|---|
| Create(RenderSenderOptions, CancellationToken) | Creates a sender that renders for RenderSenderOptions.PeerId into the app volume RenderSenderOptions.AppVolumeId, which must already exist. |
| CreateAsync(RenderSenderOptions, CancellationToken) | Async RenderSenderControl.Create; completes once the target has requested the stream. |
| SubscribeRequests(EventHandler<RenderStreamRequestEventArgs>, CancellationToken) | Raises handler for each render stream request for this application's content. |
Create
Creates a sender that renders for RenderSenderOptions.PeerId into the app
volume RenderSenderOptions.AppVolumeId, which must already exist.
public Result<RenderSender> Create(RenderSenderOptions options, CancellationToken cancellationToken = default)
Parameters
| Name | Type | Description |
|---|---|---|
options | RenderSenderOptions | |
cancellationToken | CancellationToken |
Returns: Result<RenderSender>
Exceptions
| Exception | Condition |
|---|---|
| ArgumentNullException | options is null. |
Remarks
The sender attaches its target to the app volume, which makes the target request the
content, and the call waits for that request: it does not return until the target
asks for the stream. Bound the wait with cancellationToken, or use
RenderSenderControl.CreateAsync.
Create one sender per target served; which targets to serve is the application's
decision. A PeerId.Unique target belongs to no peer, so the stream never
negotiates. A missing app volume id fails with
StatusCode.AppVolumeInvalidId.
CreateAsync
Async RenderSenderControl.Create; completes once the target has requested the stream.
public Task<Result<RenderSender>> CreateAsync(RenderSenderOptions options, CancellationToken cancellationToken = default)
Parameters
| Name | Type | Description |
|---|---|---|
options | RenderSenderOptions | |
cancellationToken | CancellationToken |
Returns: Task<Result<RenderSender>>
Exceptions
| Exception | Condition |
|---|---|
| ArgumentNullException | options is null. |
SubscribeRequests
Raises handler for each render stream request for this
application's content.
public Result<IDisposable> SubscribeRequests(EventHandler<RenderStreamRequestEventArgs> handler, CancellationToken cancellationToken = default)
Parameters
| Name | Type | Description |
|---|---|---|
handler | EventHandler<RenderStreamRequestEventArgs> | |
cancellationToken | CancellationToken |
Returns: Result<IDisposable>
Exceptions
| Exception | Condition |
|---|---|
| ArgumentNullException | handler is null. |
Remarks
A target requests the content only once it is attached to the application's app volume, so this does not discover targets for a new application: find those in the peer list and create a sender for each one served, which attaches it. It sees requests for a volume something else attached a target to. Repeated requests for a target already served need no further sender.
The handler runs on a native thread: hand the target id to the render thread with
proper synchronization. Exceptions thrown by the handler are swallowed. Disposing the
returned subscription, or cancelling cancellationToken, ends it;
once Dispose returns no handler call is running on another thread and none
starts.