Skip to content

IHmp1ConnectionHandle

Namespace: Hex1b

Assembly: Hex1b.dll

User-facing handle to a connected HMP v1 client. Delivered to user code via when the client is built through the family.

csharp
public interface IHmp1ConnectionHandle

Properties

DefaultRole

The role hint this client sent in its ClientHello, or null if no hint was supplied.

Returns: Nullable<Hmp1Role>

csharp
Hmp1Role? DefaultRole { get; }

IsPrimary

Whether this client is the current primary peer.

Returns: Boolean

csharp
bool IsPrimary { get; }

LocalDisplayName

The display name this client sent in its frame. If the caller did not supply one, this returns the auto-generated value.

Returns: String

csharp
string LocalDisplayName { get; }

OnConnected

Invoked once after the HMP v1 handshake (ClientHello → Hello → StateSync) completes successfully. Pre-populated from at adapter construction; may be replaced or composed with += at runtime (multicast handlers are awaited sequentially with per-handler exception isolation).

Returns: Func<Hmp1ConnectedEventArgs, CancellationToken, Task>

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

OnDisconnected

Invoked once when the underlying transport stream closes.

Returns: Func<CancellationToken, Task>

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

OnPeerJoined

Invoked when another peer joins the same producer.

Returns: Func<PeerJoinEventArgs, CancellationToken, Task>

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

OnPeerLeft

Invoked when another peer leaves.

Returns: Func<PeerLeaveEventArgs, CancellationToken, Task>

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

OnRemoteResized

Invoked when the producer's PTY dimensions change at runtime.

Returns: Func<RemoteResizedEventArgs, CancellationToken, Task>

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

OnRoleChanged

Invoked when the primary peer changes.

Returns: Func<RoleChangedEventArgs, CancellationToken, Task>

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

PeerId

The peer ID the producer assigned to this client in its Hello.

Returns: String

csharp
string PeerId { get; }

Peers

Snapshot of currently-connected peers (excluding self) as known to this client. Updated by PeerJoin / PeerLeave frames; set / for notifications.

Returns: IReadOnlyList<PeerInfo>

csharp
IReadOnlyList<PeerInfo> Peers { get; }

RemoteHeight

The producer's PTY height as last observed by this client.

Returns: Int32

csharp
int RemoteHeight { get; }

RemoteWidth

The producer's PTY width as last observed by this client. Updated by Resize and RoleChange frames; surfaced via .

Returns: Int32

csharp
int RemoteWidth { get; }

Methods

RequestPrimaryAsync(int, int, CancellationToken)

Asks the producer to make this peer the primary at the supplied dimensions. Observe for the acknowledged transition.

Parameters:

Returns: Task

csharp
Task RequestPrimaryAsync(int cols, int rows, CancellationToken ct = default)

Remarks

This is the recommended surface for runtime queries (peer roster, remote dimensions, primary state) and runtime actions () on an HMP1 client. It hides the underlying workload-adapter type so consumers don't need to traffic in contracts.

implements this interface; advanced consumers that construct the adapter directly (because they need to drive before assembling the surrounding terminal) get the same surface for free by referring to the adapter through this interface.

Released under the MIT License.