IBridgeRequestHandler interface

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

public interface IBridgeRequestHandler

Handles the Views protocol requests of a window's connections; the window implements it.

Remarks

Transports call it; applications implement IBridgeTransport for a custom host, not this interface.

Methods

ConnectionClosed

void ConnectionClosed(string connectionKey)

Reports that the connection connectionKey closed.

Parameters

connectionKey

The connection's key.

Remarks

The window releases the connection's session, presentations, watches and edit numbers. A transport reports each closed connection once; reporting an unknown or closed connection again does nothing. A transport may report a later connection with the key of one it reported closed: the window treats it as a new connection, with a connection identity of its own.

HandleAsync

ValueTask<ReadOnlyMemory<byte>> HandleAsync(BridgeRequest request, CancellationToken cancellationToken)

Handles one request and returns its reply.

Parameters

request

The request with the identities the transport authenticated.

cancellationToken

Cancelled when the transport no longer needs the reply, such as when the connection closed.

Returns

The reply, one JSON object as UTF-8. The transport may keep it; the handler does not reuse it.

Remarks

Every request receives a reply, including a malformed one. The task does not fault.