Skip to content

Hmp1ClientOptions

Namespace: Hex1b

Assembly: Hex1b.dll

Configures an HMP v1 client workload built via the family of builder extensions.

csharp
public sealed class Hmp1ClientOptions

Inheritance

ObjectHmp1ClientOptions

Properties

DefaultRole

Optional default-role hint sent in the frame. The producer may honour or ignore the hint.

Returns: Nullable<Hmp1Role>

csharp
public Hmp1Role? DefaultRole { get; set; }

DisplayName

Optional human-readable label sent in the frame so other peers can identify this client in roster output. When null, an auto-generated 13-character base-36 identifier is sent.

Returns: String

csharp
public string? DisplayName { get; set; }

OnConnected

Invoked once after the HMP v1 handshake (ClientHello → Hello → StateSync) completes successfully. The argument carries the for this client plus initial state (peer ID, current primary, peer roster, producer dims).

Returns: Func<Hmp1ConnectedEventArgs, CancellationToken, Task>

csharp
public Func<Hmp1ConnectedEventArgs, CancellationToken, Task>? OnConnected { get; set; }

OnDisconnected

Invoked once when the underlying transport stream closes, regardless of cause (server shutdown, network error, local cancel).

Returns: Func<CancellationToken, Task>

csharp
public Func<CancellationToken, Task>? OnDisconnected { get; set; }

OnPeerJoined

Invoked when another peer joins the same producer.

Returns: Func<PeerJoinEventArgs, CancellationToken, Task>

csharp
public Func<PeerJoinEventArgs, CancellationToken, Task>? OnPeerJoined { get; set; }

OnPeerLeft

Invoked when another peer leaves the same producer.

Returns: Func<PeerLeaveEventArgs, CancellationToken, Task>

csharp
public Func<PeerLeaveEventArgs, CancellationToken, Task>? OnPeerLeft { get; set; }

OnRemoteResized

Invoked when the producer's PTY dimensions change at runtime — either because we (as primary) requested a new size, or because another peer became primary and broadcast different dims.

Returns: Func<RemoteResizedEventArgs, CancellationToken, Task>

csharp
public Func<RemoteResizedEventArgs, CancellationToken, Task>? OnRemoteResized { get; set; }

OnRoleChanged

Invoked when this client's role transitions between primary and secondary.

Returns: Func<RoleChangedEventArgs, CancellationToken, Task>

csharp
public Func<RoleChangedEventArgs, CancellationToken, Task>? OnRoleChanged { get; set; }

StreamFactory

Transport factory invoked when the workload starts. Returns a bidirectional stream connected to the producer. required init so callers cannot accidentally replace the transport from a configure callback.

Returns: Func<CancellationToken, Stream>>

csharp
public required Func<CancellationToken, Task<Stream>> StreamFactory { get; init; }

StreamTransform

Optional async stream-wrap applied between the connect and the HMP v1 handshake. Use this to layer TLS, compression, or other framing on top of the raw transport without having to wire it into a custom .

Returns: Func<Stream, Stream>>

csharp
public Func<Stream, Task<Stream>>? StreamTransform { get; set; }

Remarks

Carries the transport (, an optional ), the handshake hints sent in the frame, and single-delegate event hooks invoked over the lifetime of the connection. Each hook is optional; null hooks are skipped.

is required init so the canonical

path can construct the options bag with the transport pre-populated; the convenience wrappers (WithHmp1Stream, WithHmp1UdsClient) pre-populate it on your behalf and invoke an additional configure callback, which cannot accidentally replace the transport.

The callback receives an whose property is the for runtime calls (e.g. ). Stash the handle for later use; this is the only place it's surfaced when the easy-path builder extensions are used.

Released under the MIT License.