Class BowireWebSocketProtocol

Namespace
Kuestenlogik.Bowire.Protocol.WebSocket
Assembly
Kuestenlogik.Bowire.Protocol.WebSocket.dll

Bowire protocol plugin for raw WebSocket connections. Discovers endpoints either from EndpointDataSource entries that carry a WebSocketEndpointAttribute (embedded mode) or from manual registration via RegisterEndpoint(WebSocketEndpointInfo). Invocation goes exclusively through the channel API: there are no unary or server-streaming WebSocket methods. Also implements IInlineWebSocketChannel so other plugins (the GraphQL plugin's graphql-transport-ws subscription support) can open WebSocket channels — with sub-protocols + auth headers — without taking a compile-time dependency on this assembly.

public sealed class BowireWebSocketProtocol : IBowireProtocol, IInlineWebSocketChannel
Inheritance
BowireWebSocketProtocol
Implements
Inherited Members

Constructors

BowireWebSocketProtocol()

public BowireWebSocketProtocol()

Fields

SubProtocolMetadataKey

Optional metadata key the user can set in the request headers to ask for one or more WebSocket sub-protocols on the upgrade handshake. Comma-separated values are split. The key is consumed before being forwarded as an HTTP header so it doesn't reach the wire as a header.

public const string SubProtocolMetadataKey = "X-Bowire-WebSocket-Subprotocol"

Field Value

string

Properties

IconSvg

SVG icon for the protocol tab.

public string IconSvg { get; }

Property Value

string

Id

Short identifier (e.g., "grpc", "signalr").

public string Id { get; }

Property Value

string

Name

Protocol name shown in UI tabs.

public string Name { get; }

Property Value

string

Settings

Settings schema this plugin contributes to the Settings dialog. Each entry becomes a toggle/input in the plugin's section. Default implementation returns empty (no plugin-specific settings).

public IReadOnlyList<BowirePluginSetting> Settings { get; }

Property Value

IReadOnlyList<BowirePluginSetting>

Methods

DiscoverAsync(string, bool, CancellationToken)

Discover available services and methods.

public Task<List<BowireServiceInfo>> DiscoverAsync(string serverUrl, bool showInternalServices, CancellationToken ct = default)

Parameters

serverUrl string
showInternalServices bool
ct CancellationToken

Returns

Task<List<BowireServiceInfo>>

Initialize(IServiceProvider?)

Called after registration to inject the app's service provider (embedded mode).

public void Initialize(IServiceProvider? serviceProvider)

Parameters

serviceProvider IServiceProvider

InvokeAsync(string, string, string, List<string>, bool, Dictionary<string, string>?, CancellationToken)

Invoke a unary or client-streaming call.

public Task<InvokeResult> InvokeAsync(string serverUrl, string service, string method, List<string> jsonMessages, bool showInternalServices, Dictionary<string, string>? metadata = null, CancellationToken ct = default)

Parameters

serverUrl string
service string
method string
jsonMessages List<string>
showInternalServices bool
metadata Dictionary<string, string>
ct CancellationToken

Returns

Task<InvokeResult>

InvokeStreamAsync(string, string, string, List<string>, bool, Dictionary<string, string>?, CancellationToken)

Invoke a server-streaming or duplex call.

public IAsyncEnumerable<string> InvokeStreamAsync(string serverUrl, string service, string method, List<string> jsonMessages, bool showInternalServices, Dictionary<string, string>? metadata = null, CancellationToken ct = default)

Parameters

serverUrl string
service string
method string
jsonMessages List<string>
showInternalServices bool
metadata Dictionary<string, string>
ct CancellationToken

Returns

IAsyncEnumerable<string>

OpenAsync(string, IReadOnlyList<string>?, Dictionary<string, string>?, CancellationToken)

Connect to url with the given sub-protocols and request headers, and return an IBowireChannel the caller can drive to send and receive frames. url must use the ws:// or wss:// scheme — http/https URLs should be rewritten by the caller before invoking this.

public Task<IBowireChannel> OpenAsync(string url, IReadOnlyList<string>? subProtocols, Dictionary<string, string>? headers, CancellationToken ct = default)

Parameters

url string
subProtocols IReadOnlyList<string>
headers Dictionary<string, string>
ct CancellationToken

Returns

Task<IBowireChannel>

OpenChannelAsync(string, string, string, bool, Dictionary<string, string>?, CancellationToken)

Open an interactive channel (for duplex/client-streaming).

public Task<IBowireChannel?> OpenChannelAsync(string serverUrl, string service, string method, bool showInternalServices, Dictionary<string, string>? metadata = null, CancellationToken ct = default)

Parameters

serverUrl string
service string
method string
showInternalServices bool
metadata Dictionary<string, string>
ct CancellationToken

Returns

Task<IBowireChannel>

RegisterEndpoint(WebSocketEndpointInfo)

Register a WebSocket endpoint for Bowire discovery. Call before MapBowire() or during startup.

public static void RegisterEndpoint(WebSocketEndpointInfo endpoint)

Parameters

endpoint WebSocketEndpointInfo