Skip to content

Fora.Client Programmer's Manual

Fora.Client is the .NET SDK for writing HLA 4 federates that connect to an RTI through the IEEE 1516-2025 Federate Protocol. This manual is for application programmers who want to build a federate, exchange object updates or interactions, receive RTI callbacks, and shut down cleanly.

For package installation and the short NuGet overview, start with this manual and the Fora package pages. Protocol internals and implementation design notes are intentionally not part of this first public site pass.

Table of Contents


Install


dotnet add package Fora.Client --version 20260705.1.0

Common namespaces:


using Fora.Abstractions;
using Fora.Abstractions.Connection;
using Fora.Abstractions.Exceptions;
using Fora.Abstractions.Handles;
using Fora.Client;
using Fora.Encoding;

Fora.Client targets .NET 10 and uses async APIs throughout. Keep one ForaClient instance per federate connection.


Minimal Federate


using Fora.Abstractions;
using Fora.Abstractions.Connection;
using Fora.Client;

await using var client = new ForaClient();
var ambassador = new MyFederateAmbassador();

// IMMEDIATE: callbacks reach the ambassador as they arrive (IEEE 1516.1-2025 §4.1).
await client.ConnectAsync(ambassador, CallbackModel.Immediate, new RtiConfiguration
{
    RtiAddress = "127.0.0.1:15164",
    Transport = RtiTransportKind.Tcp
});

await client.CreateFederationExecutionAsync("DemoFederation", "Demo.xml");
var federate = await client.JoinFederationExecutionAsync(
    federateName: "DemoFederate",
    federateType: "DemoType",
    federationName: "DemoFederation");

// Resolve handles, publish/subscribe, register objects, send updates, or send interactions here.

await client.ResignFederationExecutionAsync(ResignAction.DeleteObjects);
await client.DisconnectAsync();

Your ambassador receives callbacks:


public sealed class MyFederateAmbassador : IFederateAmbassador
{
    public Task ConnectionLostAsync(string faultDescription)
    {
        Console.Error.WriteLine($"RTI connection lost: {faultDescription}");
        return Task.CompletedTask;
    }

    public Task DiscoverObjectInstanceAsync(
        ObjectInstanceHandle instance,
        ObjectClassHandle objectClass,
        string instanceName,
        FederateHandle producingFederate)
    {
        Console.WriteLine($"Discovered {instanceName} as {instance.Value}, registered by {producingFederate.Value}");
        return Task.CompletedTask;
    }

    public Task ReceiveInteractionAsync(
        InteractionClassHandle interactionClass,
        IReadOnlyDictionary<ParameterHandle, ReadOnlyMemory<byte>> parameterValues,
        ReadOnlyMemory<byte> tag,
        TransportationTypeHandle transportationType,
        FederateHandle producingFederate,
        IReadOnlySet<RegionHandle>? optionalSentRegions)
    {
        Console.WriteLine($"Received interaction {interactionClass.Value}");
        return Task.CompletedTask;
    }

    // Implement the remaining IFederateAmbassador members used by your federate.
}

Connection Configuration

RtiConfiguration controls both the FP transport and the standard HLA connect payload.

Property Meaning
RtiAddress Host, optional port, or URI. Examples: localhost, localhost:15164, tcp://rti.example.com:15164.
Transport Physical transport: Tcp, Tls, WebSocket, or SecureWebSocket.
ConfigurationName Optional RTI configuration name sent in the HLA connect request.
AdditionalSettings Vendor-specific settings string sent in the HLA connect request.
Credentials Optional HLA credential record.

Default ports:

Transport Default Port
Tcp 15164
Tls 15165
WebSocket 80
SecureWebSocket 443

Plain TCP:


await client.ConnectAsync(new RtiConfiguration
{
    RtiAddress = "localhost:15164",
    Transport = RtiTransportKind.Tcp
}, ambassador);

TLS:


await client.ConnectAsync(new RtiConfiguration
{
    RtiAddress = "localhost:15165",
    Transport = RtiTransportKind.Tls
}, ambassador);

Password credentials:


await client.ConnectAsync(new RtiConfiguration
{
    RtiAddress = "localhost:15164",
    Transport = RtiTransportKind.Tcp,
    Credentials = new HlaPlainTextPasswordCredentials("changeit")
}, ambassador);

HlaPlainTextPasswordCredentials carries only the password. Use TLS or a trusted private network when sending password credentials.


Ambassador Callbacks

Implement IFederateAmbassador to receive RTI-to-federate callbacks. The interface covers:

Callback Area Examples
Connection and federation events ConnectionLostAsync, ReportFederationExecutionsAsync, save/restore callbacks
Synchronization AnnounceSynchronizationPointAsync, FederationSynchronizedAsync
Declaration advisories StartRegistrationForObjectClassAsync, TurnInteractionsOnAsync
Object management DiscoverObjectInstanceAsync, ReflectAttributeValuesAsync, ReceiveInteractionAsync, RemoveObjectInstanceAsync
Ownership RequestAttributeOwnershipReleaseAsync, AttributeOwnershipAcquisitionNotificationAsync
Time management TimeRegulationEnabledAsync, TimeConstrainedEnabledAsync, TimeAdvanceGrantAsync

Keep callback methods short. If a callback needs slow application work, queue that work onto your own application pipeline and return promptly. The SDK acknowledges FP callback frames after dispatch, so long callback methods can slow protocol progress.


Callback Delivery Models

The federate chooses the callback model at Connect (IEEE 1516.1-2025 §4.1, §4.2). In the IMMEDIATE model the SDK invokes callbacks as they arrive, on its callback thread; in the EVOKED model — the default of the ConnectAsync overloads without a model — only within Evoke Callback(s), on the caller's thread. EnableAsynchronousDeliveryAsync() is not a delivery control: it is the Time Management service of §8.15, for a joined, time-constrained federate.

API Effect
ConnectAsync(..., CallbackModel.Immediate, ...) Callbacks reach the ambassador as they arrive. The usual model for active applications.
ConnectAsync(..., CallbackModel.Evoked, ...) Callbacks wait for EvokeCallbackAsync / EvokeMultipleCallbacksAsync.
EvokeCallbackAsync() In the EVOKED model, dispatches at most one callback; no effect in the IMMEDIATE model (§10.57).
EvokeMultipleCallbacksAsync(min, max) In the EVOKED model, dispatches callbacks during the time window; no effect in the IMMEDIATE model (§10.58).
DisableCallbacksAsync() Locally gates ambassador delivery while the FP session still acknowledges RTI callback frames.
EnableCallbacksAsync() Re-enables local ambassador delivery and drains the gated callback buffer.

Recommended default:


await client.ConnectAsync(ambassador, CallbackModel.Immediate, configuration);

Synchronous polling style:


await client.ConnectAsync(ambassador, CallbackModel.Evoked, configuration);

while (!ct.IsCancellationRequested)
{
    bool delivered = await client.EvokeCallbackAsync(
        approxMinTimeInSeconds: 0.1,
        ct);

    if (!delivered)
        await Task.Delay(10, ct);
}

Do not call EvokeCallbackAsync after enabling asynchronous delivery.


Federation Lifecycle

Typical lifecycle:

  1. Connect to the RTI.
  2. Create or discover a federation execution.
  3. Join the federation.
  4. Resolve FOM handles.
  5. Publish and subscribe.
  6. Register object instances or send interactions.
  7. Resign from the federation.
  8. Disconnect from the RTI.

Create and join:


await client.CreateFederationExecutionAsync(
    federationName: "DemoFederation",
    fomPath: "Demo.xml",
    ct: ct);

FederateHandle federate = await client.JoinFederationExecutionAsync(
    federateName: "PublisherA",
    federateType: "Publisher",
    federationName: "DemoFederation",
    ct: ct);

List federations and members:


var federations = await client.ListFederationExecutionsAsync(ct);
var members = await client.ListFederationExecutionMembersAsync("DemoFederation", ct);

Resign and cleanup:


await client.ResignFederationExecutionAsync(ResignAction.DeleteObjects, ct);
await client.DisconnectAsync(ct);

Call DisconnectAsync only after resigning. RTIs may reject disconnect while the federate is still joined.


Handles and FOM Lookup

Most HLA services use handles instead of names. Resolve handles after joining, then cache them in your application state.


ObjectClassHandle vehicleClass =
    await client.GetObjectClassHandleAsync("HLAobjectRoot.Vehicle", ct);

AttributeHandle positionAttribute =
    await client.GetAttributeHandleAsync(vehicleClass, "Position", ct);

InteractionClassHandle fireEvent =
    await client.GetInteractionClassHandleAsync("HLAinteractionRoot.FireEvent", ct);

ParameterHandle munitionParameter =
    await client.GetParameterHandleAsync(fireEvent, "MunitionId", ct);

Reverse lookup is also available:


string className = await client.GetObjectClassNameAsync(vehicleClass, ct);
string interactionName = await client.GetInteractionClassNameAsync(fireEvent, ct);

Use the support-service lookup calls rather than hard-coding numeric handle values. Numeric values are RTI/FOM-session artifacts.


Encoding Attribute and Parameter Values

HLA attributes and parameters are byte payloads. Fora.Client does not infer your FOM datatype. Your federate must encode values according to the FOM.

Simple primitive encoding:


byte[] speed = HlaPrimitives.EncodeFloat64Be(12.5);
byte[] name = HlaPrimitives.EncodeUnicodeString("Alpha");
byte[] count = HlaPrimitives.EncodeInt32Be(42);

Attribute maps use AttributeHandle keys:


var attributes = new Dictionary<AttributeHandle, byte[]>
{
    [positionAttribute] = EncodePosition(10.0, 20.0, 30.0),
    [nameAttribute] = HlaPrimitives.EncodeUnicodeString("Vehicle-1")
};

Interaction maps use ParameterHandle keys:


var parameters = new Dictionary<ParameterHandle, byte[]>
{
    [munitionParameter] = HlaPrimitives.EncodeUnicodeString("M-001")
};

Generated federates can use the encoded overloads to defer encoding until the SDK telemetry wrapper measures it:


await client.UpdateAttributeValuesEncodedAsync(
    instance,
    encoder: () => VehicleEncoder.Encode(vehicleDto, som),
    tag: Array.Empty<byte>(),
    ct: ct);

For composed datatypes, use Fora.Encoding records and arrays or generated codec code from your FOM tooling. Make sure padding and octet boundaries match IEEE 1516.2-2025.


Publish, Subscribe, Update, and Interact

Publish and subscribe before exchanging data:


await client.PublishObjectClassAttributesAsync(
    vehicleClass,
    new HashSet<AttributeHandle> { positionAttribute, nameAttribute },
    ct);

await client.SubscribeObjectClassAttributesAsync(
    vehicleClass,
    new HashSet<AttributeHandle> { positionAttribute, nameAttribute },
    ct);

await client.PublishInteractionClassAsync(fireEvent, ct);
await client.SubscribeInteractionClassAsync(fireEvent, ct);

Update object attributes:


await client.UpdateAttributeValuesAsync(
    instance,
    attributes,
    tag: Array.Empty<byte>(),
    ct: ct);

Send a receive-order interaction:


await client.SendInteractionAsync(
    fireEvent,
    parameters,
    tag: Array.Empty<byte>(),
    ct: ct);

Send a timestamp-order interaction:


MessageRetractionHandle? retraction = await client.SendInteractionAsync(
    fireEvent,
    parameters,
    tag: Array.Empty<byte>(),
    time: 15.0,
    ct: ct);

The optional return value is a message retraction handle for timestamp-order sends when the RTI supplies one.


Object Instances

Register an object instance after publishing the object class; the RTI gives it a unique name:


ObjectInstanceHandle instance = await client.RegisterObjectInstanceAsync(vehicleClass, ct);

To register with a name of your own, reserve it first (IEEE 1516.1-2025 §6.2, §6.8). The name belongs to the federate in its federation execution until it releases it or resigns; it shall not begin with "HLA":


await client.ReserveObjectInstanceNameAsync("Vehicle-1", ct);
// ... after ObjectInstanceNameReservationSucceededAsync("Vehicle-1"):
ObjectInstanceHandle named = await client.RegisterObjectInstanceAsync(vehicleClass, "Vehicle-1", ct);

The result is delivered through ObjectInstanceNameReservationSucceededAsync or ObjectInstanceNameReservationFailedAsync. A name the federate has not reserved raises HlaObjectInstanceNameNotReserved.

Delete an object instance:


await client.DeleteObjectInstanceAsync(
    instance,
    tag: Array.Empty<byte>(),
    ct: ct);

Subscribers receive DiscoverObjectInstanceAsync, ReflectAttributeValuesAsync, and RemoveObjectInstanceAsync callbacks according to their subscriptions and RTI routing rules.


Time Management

Enable time regulation and/or time constrained mode before using timestamp-order services:


await client.EnableTimeRegulationAsync(lookahead: 1.0, ct: ct);
await client.EnableTimeConstrainedAsync(ct);

The ambassador receives:


Task TimeRegulationEnabledAsync(double logicalTime);
Task TimeConstrainedEnabledAsync(double logicalTime);

Advance time:


await client.TimeAdvanceRequestAsync(10.0, ct);

The grant arrives through:


Task TimeAdvanceGrantAsync(double logicalTime);

A time-constrained federate receives messages only in the Time Advancing state, between an advance request and its grant (IEEE 1516.1-2025 §8.1.1); the messages that arrive after a grant wait at the RTI for the next request. To receive RO messages in the Time Granted state as well, call EnableAsynchronousDeliveryAsync() (§8.15); TSO messages still wait for the grant that passes them. DisableTimeConstrainedAsync() delivers the waiting TSO messages as RO messages (§8.7).

Other supported advance services:

Service API
Time Advance Request Available TimeAdvanceRequestAvailableAsync(time)
Next Message Request NextMessageRequestAsync(time)
Next Message Request Available NextMessageRequestAvailableAsync(time)
Flush Queue Request FlushQueueRequestAsync(time)

Time Advance Request and Next Message Request are granted only below GALT, the other advance services at or below it (IEEE 1516.1-2025 §8.1.2): with zero lookahead, a federate granted by Time Advance Request to T sends TSO messages only beyond T, one granted by Time Advance Request Available also at T. Flush Queue Request is granted at once. A smaller lookahead given to ModifyLookaheadAsync is reached gradually as logical time advances (§8.20); QueryLookaheadAsync returns the actual lookahead and needs a time-regulating federate.

Query time state:


double time = await client.QueryLogicalTimeAsync(ct);
double lookahead = await client.QueryLookaheadAsync(ct);
double galt = await client.QueryGALTAsync(ct);
double lits = await client.QueryLITSAsync(ct);

Data Distribution Management

Create a region from dimensions, commit ranges, and use region-aware subscription or update services.


DimensionHandle area =
    await client.GetDimensionHandleAsync("Area", ct);

RegionHandle region =
    await client.CreateRegionAsync(new HashSet<DimensionHandle> { area }, ct);

await client.CommitRegionModificationsAsync(
    new Dictionary<RegionHandle, IReadOnlyDictionary<DimensionHandle, RangeBounds>>
    {
        [region] = new Dictionary<DimensionHandle, RangeBounds>
        {
            [area] = new RangeBounds(0, 100)
        }
    },
    ct);

Subscribe attributes with regions:


await client.SubscribeObjectClassAttributesWithRegionsAsync(
    vehicleClass,
    new Dictionary<AttributeHandle, IReadOnlySet<RegionHandle>>
    {
        [positionAttribute] = new HashSet<RegionHandle> { region }
    },
    ct);

The optional arguments of §9.8.1 — a passive subscription, which starts no registration and turns no updates on, and an update rate of the FDD:


await client.SubscribeObjectClassAttributesWithRegionsAsync(
    vehicleClass, attributeRegions, passive: true, updateRateDesignator: "Slow", ct);

The federate name of JoinFederationExecutionAsync is optional (§4.11.1): JoinFederationExecutionAsync(federateType, federationName) joins with a unique name the RTI assigns. RequestAttributeValueUpdateAsync takes an object instance or an object class (§6.21); for a class, every instance of it and its subclasses is asked.

Associate a registered object with update regions:


await client.AssociateRegionsForUpdatesAsync(
    instance,
    new Dictionary<AttributeHandle, IReadOnlySet<RegionHandle>>
    {
        [positionAttribute] = new HashSet<RegionHandle> { region }
    },
    ct);

When region conveyance is enabled, matching sent regions can be delivered to the ambassador through the DDM-aware callback overloads.


Ownership Management

Ownership APIs map directly to HLA attribute ownership workflows.

Acquire if available:


await client.AttributeOwnershipAcquisitionIfAvailableAsync(
    instance,
    new HashSet<AttributeHandle> { positionAttribute },
    ct);

Request negotiated acquisition:


await client.AttributeOwnershipAcquisitionAsync(
    instance,
    new HashSet<AttributeHandle> { positionAttribute },
    tag: Array.Empty<byte>(),
    ct);

Release ownership:


await client.UnconditionalAttributeOwnershipDivestitureAsync(
    instance,
    new HashSet<AttributeHandle> { positionAttribute },
    ct);

Relevant callbacks include RequestAttributeOwnershipReleaseAsync, AttributeOwnershipAcquisitionNotificationAsync, AttributeOwnershipUnavailableAsync, and InformAttributeOwnershipAsync.


Support Services

Support services are used heavily by generated federates and diagnostics:

Need API Examples
Handle/name lookup GetObjectClassHandleAsync, GetAttributeHandleAsync, GetInteractionClassHandleAsync, GetParameterHandleAsync
FOM metadata GetFddInfoAsync, GetObjectClassInformationAsync, GetInteractionClassInformationAsync
DDM metadata GetDimensionHandleAsync, GetDimensionUpperBoundAsync, GetAvailableDimensionsForClassAttributeAsync
Transportation/order GetTransportationTypeHandleAsync, GetOrderTypeAsync, ChangeAttributeOrderTypeAsync
Callback control EnableCallbacksAsync, DisableCallbacksAsync, EvokeCallbackAsync
RTI switches SetConveyRegionDesignatorSetsAsync, SetServiceReportingAsync, advisory switch APIs

Logging and Diagnostics

Subscribe to the Logged event for SDK diagnostics:


client.MinimumLogLevel = ForaLogLevel.Debug;
client.Logged += (_, e) =>
{
    Console.WriteLine($"[{e.Level}] {e.Message}");
};

The ForaClient(ILogger<ForaClient>) constructor also forwards SDK logs into Microsoft.Extensions.Logging.

Useful diagnostic signals:

Signal Meaning
ConnectionLostAsync RTI or transport ended the FP session. Stop issuing HLA calls and reconnect intentionally.
HlaNotConnected The client is not connected, has been disposed, or the RTI terminated the FP session.
Logged warnings/errors Protocol, RTI service, or lifecycle issues surfaced by the SDK.

Disconnect and Session Termination

For normal shutdown:


await client.ResignFederationExecutionAsync(ResignAction.DeleteObjects, ct);
await client.DisconnectAsync(ct);

DisconnectAsync sends the HLA disconnect service and then disposes the FP connection. During disposal, the SDK performs the standard CTRL_TERMINATE_SESSION to CTRL_SESSION_TERMINATED handshake when the session is still active.

If the RTI initiates session termination, the SDK:

  1. Stops local heartbeat, callback, receive, and transport services.
  2. Acknowledges CTRL_TERMINATE_SESSION with CTRL_SESSION_TERMINATED when required.
  3. Raises IFederateAmbassador.ConnectionLostAsync.
  4. Rejects later HLA service calls with HlaNotConnected instead of writing to a dead FP session.

Treat ConnectionLostAsync as a terminal state for the current ForaClient instance. Create a new client and reconnect when your application policy allows it.


Error Handling

RTI-reported service exceptions are mapped to HlaException subclasses when possible.


try
{
    await client.CreateFederationExecutionAsync("DemoFederation", "Demo.xml", ct);
}
catch (HlaFederationExecutionAlreadyExists)
{
    // Safe to continue if another federate already created it.
}
catch (HlaException ex)
{
    Console.Error.WriteLine($"{ex.ErrorType}: {ex.Message}");
    throw;
}

Common lifecycle exceptions:

Exception Typical Cause
HlaAlreadyConnected ConnectAsync was called on an already connected client.
HlaNotConnected A service was called before connect, after disconnect, after dispose, or after RTI-side session termination.
HlaFederateAlreadyExecutionMember Join was requested when already joined.
HlaFederateNotExecutionMember A joined-only service was called before joining.
HlaFederateIsExecutionMember A not-joined service, such as destroy/disconnect, was requested while still joined.
HlaUnauthorized / HlaInvalidCredentials RTI authorization rejected the connect request.

Always pass cancellation tokens from your application shutdown path. If your application needs per-call timeouts, wrap calls with a CancellationTokenSource until your policy is enforced at a higher layer.


A maintainable federate usually separates these responsibilities:

Class Responsibility
FederateApp Owns ForaClient, startup/shutdown, and top-level state.
FederateAmbassador Implements IFederateAmbassador and queues domain events.
SomHandles Stores resolved object, attribute, interaction, parameter, and dimension handles.
FederateCodecs Encodes/decodes FOM datatypes to and from byte arrays.
PublicationService Registers objects and sends updates/interactions.
SubscriptionService Applies received callbacks to application state.

Suggested startup order:

  1. Build ForaClient and ambassador.
  2. Connect.
  3. Enable asynchronous callback delivery unless your federate intentionally polls callbacks.
  4. Create or join the federation.
  5. Resolve and cache handles.
  6. Publish and subscribe.
  7. Register objects and run the simulation loop.

Suggested shutdown order:

  1. Stop your simulation loop.
  2. Delete or resign-owned objects if your policy requires it.
  3. Resign from the federation.
  4. Disconnect.
  5. Dispose the client.

This keeps HLA protocol concerns out of UI, simulation-domain, and encoding code while still letting the ambassador react quickly to RTI callbacks.

Disclaimer

See the Disclaimer for usage terms and research-only conditions.


Updated November 18, 2026, 21:47:16 (UTC+03:00)