ClientFixSession
Represents a connected FIX client session with its own writer, dialect, and outgoing message queue.
Inherits: FixSession
Implements: IMessageListenerSession, ILogReceiver, ILogSource, IDisposable
Constructors
public ClientFixSession(IFixDialect fixDialect, string version, string language, Stream clientStream, TcpClient client, TimeSpan quotesInterval, FixSession serverSession, string authorizationToken, ISessionTransactionIdStorage transactionIdStorage, bool checkSumDisabled, bool isDemo, int maxPendingMessages)
clientFixSession = ClientFixSession(fixDialect, version, language, clientStream, client, quotesInterval, serverSession, authorizationToken, transactionIdStorage, checkSumDisabled, isDemo, maxPendingMessages)
Initializes a new instance of the ClientFixSession.
- fixDialect
- FIX dialect for message parsing and writing.
- version
- FIX protocol version string.
- language
- Client language preference.
- clientStream
- Network stream for communication.
- client
- TCP client connection.
- quotesInterval
- Interval for aggregating quote updates.
- serverSession
- Parent server-side session configuration.
- authorizationToken
- Authorization token returned after successful login.
- transactionIdStorage
- Storage for mapping FIX request IDs to internal transaction IDs.
- checkSumDisabled
- Whether FIX checksum validation is disabled.
- isDemo
- Whether this is a demo session.
- maxPendingMessages
- Maximum number of queued outgoing work items before backpressure forces a disconnect. Zero means unbounded.
Properties
public string AuthorizationToken { get; }
value = clientFixSession.AuthorizationToken
Authorization token assigned to this session after successful login.
public long BytesReceived { get; set; }
value = clientFixSession.BytesReceived
clientFixSession.BytesReceived = value
The number of bytes received.
public long BytesSent { get; set; }
value = clientFixSession.BytesSent
clientFixSession.BytesSent = value
The number of bytes sent.
public int ErrorCount { get; set; }
value = clientFixSession.ErrorCount
clientFixSession.ErrorCount = value
The number of errors.
public IFixDialect FixDialect { get; }
value = clientFixSession.FixDialect
FIX dialect used by this session for message serialization.
public override bool IsConnected { get; }
value = clientFixSession.IsConnected
Is connected.
public bool IsDemo { get; }
value = clientFixSession.IsDemo
Whether this session operates in demo mode.
public string Language { get; }
value = clientFixSession.Language
Client language preference (e.g. "en", "ru").
public int OutgoingQueueCount { get; }
value = clientFixSession.OutgoingQueueCount
Current size of the outgoing message queue (-1 if the channel does not expose a count).
public TimeSpan QuotesInterval { get; }
value = clientFixSession.QuotesInterval
Interval for aggregating incremental quote updates before sending.
public EndPoint RemoteEndPoint { get; }
value = clientFixSession.RemoteEndPoint
Remote endpoint address of the connected client.
public IFixServerSerializer Serializer { get; private set; }
value = clientFixSession.Serializer
clientFixSession.Serializer = value
The FIX serializer for this session.
public FixSession ServerSession { get; }
value = clientFixSession.ServerSession
Parent server-side session configuration.
public int TotalErrorCount { get; set; }
value = clientFixSession.TotalErrorCount
clientFixSession.TotalErrorCount = value
Total error count.
public ISessionTransactionIdStorage TransactionIdStorage { get; }
value = clientFixSession.TransactionIdStorage
public DateTime UpdatedTime { get; }
value = clientFixSession.UpdatedTime
UTC timestamp of the last received message (heartbeat or data).
public string Version { get; }
value = clientFixSession.Version
FIX protocol version reported by the client during logon.
public IFixWriter Writer { get; }
value = clientFixSession.Writer
FIX writer for serializing outgoing messages.
Methods
protected override void DisposeManaged()
clientFixSession.DisposeManaged()
Release resources.
public bool EnqueueWork(ServerSubscription subscription, string requestId, Func<ClientFixSession, string, CancellationToken, ValueTask<bool>> handler)
result = clientFixSession.EnqueueWork(subscription, requestId, handler)
Enqueue a serialization work item for processing. Returns if the queue is full or completed (client backpressure) so the caller can force a disconnect.
public override void IncreaseBytesSent(int count)
clientFixSession.IncreaseBytesSent(count)
Increase BytesSent.
- count
- Value.
public override void IncreaseErrorCount()
clientFixSession.IncreaseErrorCount()
Increase ErrorCount.
public Task Init(FixServerSettings serverSettings, Action<ClientFixSession> logout, CancellationToken cancellationToken)
result = clientFixSession.Init(serverSettings, logout, cancellationToken)
Start the outgoing message processing loop for this session.
- serverSettings
- Server settings (used for max error thresholds).
- logout
- Callback to invoke when the session must be forcefully disconnected.
- cancellationToken
- Cancellation token.
Returns: Task that runs for the lifetime of the session.
public void InitSerializer(IFixReader reader)
clientFixSession.InitSerializer(reader)
Initialize the serializer with the given reader.
- reader
- The FIX reader for incoming messages.
public void Ping()
clientFixSession.Ping()
Update the last activity timestamp to the current UTC time.
public override void ResetErrorCount()
clientFixSession.ResetErrorCount()
Reset ErrorCount.