ข้ามไปยังเนื้อหา

Class WebSocketBehaviorBinding

เนื้อหานี้ยังไม่ได้แปลเป็นภาษาไทย แสดงเป็นภาษาอังกฤษแทน

Namespace: Cephalon.Behaviors.Http.Bindings
Assembly: Cephalon.Behaviors.Http.dll

Bidirectional WebSocket transport binding (transport ID: http.ws). Upgrades canonical routes such as GET /ws/v1/cart/get to a full-duplex WebSocket connection. Each received JSON text frame is dispatched to the behavior and the result is sent back as a JSON text frame. The connection is closed gracefully on client close or cancellation.

public sealed class WebSocketBehaviorBinding : IHttpBehaviorBinding

objectWebSocketBehaviorBinding

IHttpBehaviorBinding

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Canonical routes are derived from the shared plus the configured WebSocket prefix (canonically ApiRoutes:Prefixes:Ws) and the resolved default behavior document name. controls the configurable root prefix.

WebSocketBehaviorBinding(IConfiguration?)

Section titled “ WebSocketBehaviorBinding(IConfiguration?)”

Initializes a new .

public WebSocketBehaviorBinding(IConfiguration? configuration = null)

configuration IConfiguration?

Optional configuration used to resolve canonical behavior transport routes. When omitted, the binding falls back to the default /ws/v1 route policy.

Gets the canonical transport identifier, e.g. http.jsonrpc.

public string TransportId { get; }

string

MapAsync(WebApplication, BehaviorTopologyDescriptor, BehaviorDispatcher)

Section titled “ MapAsync(WebApplication, BehaviorTopologyDescriptor, BehaviorDispatcher)”

Maps the behavior’s routes/endpoints onto the . Called at most once per descriptor per transport (lazy-init guards ensure this).

public Task MapAsync(WebApplication app, BehaviorTopologyDescriptor descriptor, BehaviorDispatcher dispatcher)

app WebApplication

The web application to register routes on.

descriptor BehaviorTopologyDescriptor

The behavior topology descriptor.

dispatcher BehaviorDispatcher

The behavior dispatcher to invoke.

Task

A task that completes when all routes are mapped.