ClientFixSession

StockSharp.Server.Fix

Represents a connected FIX client session with its own writer, dialect, and outgoing message queue.

Inherits: FixSession

Implements: IMessageListenerSession, ILogReceiver, ILogSource, IDisposable

Constructors

ClientFixSession
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

AuthorizationToken
public string AuthorizationToken { get; }
value = clientFixSession.AuthorizationToken

Authorization token assigned to this session after successful login.

BytesReceived
public long BytesReceived { get; set; }
value = clientFixSession.BytesReceived
clientFixSession.BytesReceived = value

The number of bytes received.

BytesSent
public long BytesSent { get; set; }
value = clientFixSession.BytesSent
clientFixSession.BytesSent = value

The number of bytes sent.

ErrorCount
public int ErrorCount { get; set; }
value = clientFixSession.ErrorCount
clientFixSession.ErrorCount = value

The number of errors.

FixDialect
public IFixDialect FixDialect { get; }
value = clientFixSession.FixDialect

FIX dialect used by this session for message serialization.

IsConnected
public override bool IsConnected { get; }
value = clientFixSession.IsConnected

Is connected.

IsDemo
public bool IsDemo { get; }
value = clientFixSession.IsDemo

Whether this session operates in demo mode.

Language
public string Language { get; }
value = clientFixSession.Language

Client language preference (e.g. "en", "ru").

OutgoingQueueCount
public int OutgoingQueueCount { get; }
value = clientFixSession.OutgoingQueueCount

Current size of the outgoing message queue (-1 if the channel does not expose a count).

QuotesInterval
public TimeSpan QuotesInterval { get; }
value = clientFixSession.QuotesInterval

Interval for aggregating incremental quote updates before sending.

RemoteEndPoint
public EndPoint RemoteEndPoint { get; }
value = clientFixSession.RemoteEndPoint

Remote endpoint address of the connected client.

Serializer
public IFixServerSerializer Serializer { get; private set; }
value = clientFixSession.Serializer
clientFixSession.Serializer = value

The FIX serializer for this session.

ServerSession
public FixSession ServerSession { get; }
value = clientFixSession.ServerSession

Parent server-side session configuration.

TotalErrorCount
public int TotalErrorCount { get; set; }
value = clientFixSession.TotalErrorCount
clientFixSession.TotalErrorCount = value

Total error count.

TransactionIdStorage
public ISessionTransactionIdStorage TransactionIdStorage { get; }
value = clientFixSession.TransactionIdStorage
UpdatedTime
public DateTime UpdatedTime { get; }
value = clientFixSession.UpdatedTime

UTC timestamp of the last received message (heartbeat or data).

Version
public string Version { get; }
value = clientFixSession.Version

FIX protocol version reported by the client during logon.

Writer
public IFixWriter Writer { get; }
value = clientFixSession.Writer

FIX writer for serializing outgoing messages.

Methods

DisposeManaged
protected override void DisposeManaged()
clientFixSession.DisposeManaged()

Release resources.

EnqueueWork
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.

IncreaseBytesSent
public override void IncreaseBytesSent(int count)
clientFixSession.IncreaseBytesSent(count)

Increase BytesSent.

count
Value.
IncreaseErrorCount
public override void IncreaseErrorCount()
clientFixSession.IncreaseErrorCount()

Increase ErrorCount.

Init
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.

InitSerializer
public void InitSerializer(IFixReader reader)
clientFixSession.InitSerializer(reader)

Initialize the serializer with the given reader.

reader
The FIX reader for incoming messages.
Ping
public void Ping()
clientFixSession.Ping()

Update the last activity timestamp to the current UTC time.

ResetErrorCount
public override void ResetErrorCount()
clientFixSession.ResetErrorCount()

Reset ErrorCount.