RebindableBridgeTransport class

Namespace Runic.Application.Views.CsWebUi · Runic.Application.CsWebUi 0.7.0-preview.5

public sealed class RebindableBridgeTransport : IBridgeTransport, IDisposable

Inherits or implements IBridgeTransport, IDisposable.

Keeps each native route for a window while Bridge attachments replace its managed handler. Dispose this transport before disposing the window.

Constructors

RebindableBridgeTransport

public RebindableBridgeTransport(IBridgeTransport inner)

Wraps the native transport whose routes are kept.

Methods

Bind

public IDisposable Bind(string name, Func<IBridgeArguments, string> handler)

Binds a synchronous browser route.

Returns

A lease that unbinds the route.

Exceptions

InvalidOperationException

The route already has an active bridge or changed between sync and async.

Documentation from IBridgeTransport.Bind.

BindAsync

public IDisposable BindAsync(string name, Func<IBridgeArguments, CancellationToken, ValueTask<string>> handler)

Binds an asynchronous browser route.

Returns

A lease that unbinds the route.

Exceptions

InvalidOperationException

The route already has an active bridge or changed between sync and async.

Documentation from IBridgeTransport.BindAsync.

Dispose

public void Dispose()

Unbinds every native route. Dispose this transport before its window.

Publish

public void Publish(string name, string stateJson)

Delivers an encoded state snapshot to the browser listener for name.

Remarks

A transport that does not implement IAsyncBridgeTransport must send every call, in call order and without coalescing, because collection delta frames depend on every preceding frame. CS-WebUI does this: each call writes one WebSocket message to every connected client and returns once the socket write completes.

Documentation from IBridgeTransport.Publish.