IBridgeConnectionTransport interface

Namespace Runic.Application.Views in Runic.Application.Views 0.23.0

public interface IBridgeConnectionTransport : IBridgeTransport

Inherits or implements IBridgeTransport.

A transport that can push to one connection outside a request.

Remarks

The pushes and replies of one connection keep the order in which the window sent them, whether they were broadcast or targeted.

Methods

SendAsync

ValueTask<bool> SendAsync(string connectionKey, ReadOnlyMemory<byte> message, CancellationToken cancellationToken = default)

Sends one push to the connection connectionKey.

Parameters

connectionKey

The connection's key, as the transport supplied it in BridgeRequest.ConnectionKey.

message

The push, one JSON object as UTF-8. It is valid until the returned task completes.

cancellationToken

Stops waiting for the send; the push may still be delivered.

Returns

true when the transport handed the push to the connection; false when the connection is not open.

Remarks

The window looks up the open connection and calls this with its transport key outside its own lock, so a send can be in flight while the connection closes. A transport must not give that key to a new connection while a send to it is in flight: complete or fail the send first, so the push never reaches the connection that came next.