ClientSbeSession

StockSharp.Server.Sbe

SBE client session — one per connected client.

Inherits: SbeSession

Implements: IMessageListenerSession, ILogReceiver, ILogSource, IDisposable

Constructors

ClientSbeSession
public ClientSbeSession(string version, string language, Stream clientStream, TcpClient client, SbeSession serverSession, string authorizationToken, ISessionTransactionIdStorage transactionIdStorage, bool isDemo, int maxPendingMessages)
clientSbeSession = ClientSbeSession(version, language, clientStream, client, serverSession, authorizationToken, transactionIdStorage, isDemo, maxPendingMessages)

Initializes a new instance of the ClientSbeSession.

Properties

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

Authorization token assigned after successful login.

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

The number of bytes received.

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

The number of bytes sent.

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

The number of errors.

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

Is connected.

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

Whether this is a demo session.

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

Client language code.

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

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

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

Remote endpoint of the connected client.

Serializer
public SbeRecordSerializer Serializer { get; }
value = clientSbeSession.Serializer

SBE serializer for this session.

ServerSession
public SbeSession ServerSession { get; }
value = clientSbeSession.ServerSession

Server-side session configuration.

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

Total error count.

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

Timestamp of the last received message (heartbeat or data).

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

Client application version.

WriteBuffer
public byte[] WriteBuffer { get; }
value = clientSbeSession.WriteBuffer

Per-session write buffer for SBE serialization. Each session needs its own buffer because outgoing messages are processed concurrently in separate Tasks. The buffer grows on demand (see Int32)) so large frames are not dropped.

Methods

DisposeManaged
protected override void DisposeManaged()
clientSbeSession.DisposeManaged()

Release resources.

EnqueueWork
public bool EnqueueWork(ServerSubscription subscription, string requestId, Func<ClientSbeSession, string, CancellationToken, ValueTask<bool>> handler)
result = clientSbeSession.EnqueueWork(subscription, requestId, handler)

Enqueue a serialization work item for processing. Returns false if the queue is full (client backpressure).

EnsureWriteBuffer
public void EnsureWriteBuffer(int minSize)
clientSbeSession.EnsureWriteBuffer(minSize)

Ensures the write buffer can hold at least bytes, reallocating (doubling capacity) when the current buffer is too small.

minSize
Minimum required buffer size in bytes.
IncreaseBytesSent
public override void IncreaseBytesSent(int count)
clientSbeSession.IncreaseBytesSent(count)

Increase BytesSent.

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

Increase ErrorCount.

Init
public Task Init(SbeServerSettings serverSettings, Action<ClientSbeSession> logout, CancellationToken cancellationToken)
result = clientSbeSession.Init(serverSettings, logout, cancellationToken)

Start the outgoing message processing loop.

Ping
public void Ping()
clientSbeSession.Ping()

Updates the last-activity timestamp to now.

ResetErrorCount
public override void ResetErrorCount()
clientSbeSession.ResetErrorCount()

Reset ErrorCount.

WriteFramedMessageAsync
public ValueTask WriteFramedMessageAsync(ReadOnlyMemory<byte> payload, CancellationToken cancellationToken)
result = clientSbeSession.WriteFramedMessageAsync(payload, cancellationToken)

Write SBE framed message to the client stream. [4-byte length prefix (uint32 LE)][SBE message payload]