TsgcWebSocketClientProperties › QueueOptions

QueueOptions Property

Queues outgoing Text, Binary and Ping messages so they are serialised on the connection thread.

Syntax

property QueueOptions: TsgcWSQueueClient_Options read FQueueOptions write SetQueueOptions;

Default Value

Text.Level=qmNone, Binary.Level=qmNone, Ping.Level=qmNone, MaxQueueSize=0, OverflowPolicy=qopDropOldest

Remarks

By default messages are written directly on the caller thread. Assigning a queue level (qmLevel0, qmLevel1 or qmLevel2) enqueues them and sends them sequentially from the connection thread, avoiding locks when several threads call WriteData or Ping at once. Messages at qmLevel0 are processed before qmLevel1, and qmLevel1 before qmLevel2, so higher-priority categories (for example ping) can be delivered ahead of payloads.

MaxQueueSize bounds the number of messages a queue may hold: zero (default) means unbounded, keeping the previous behaviour. When the limit is reached, OverflowPolicy decides what happens with new messages: qopDropOldest (default) discards the oldest queued message to make room, qopDropNewest discards the new message, and qopDisconnect discards it and closes the connection. Each time the limit is hit the OnSendBufferFull event fires first, allowing the application to monitor backpressure or override the drop.

Example


oClient := TsgcWebSocketClient.Create(nil);
oClient.URL := 'wss://www.esegece.com:2053';
oClient.QueueOptions.Ping.Level := qmLevel1;
oClient.QueueOptions.Text.Level := qmLevel2;
oClient.QueueOptions.Binary.Level := qmLevel2;
oClient.Active := true;

Back to Properties