TsgcWebSocketClient › Properties › QueueOptions
Queues outgoing Text, Binary and Ping messages so they are serialised on the connection thread.
property QueueOptions: TsgcWSQueueClient_Options read FQueueOptions write SetQueueOptions;
Text.Level=qmNone, Binary.Level=qmNone, Ping.Level=qmNone, MaxQueueSize=0, OverflowPolicy=qopDropOldest
By default messages are written directly on the caller thread. Assigning a queue level (qmLevel1, qmLevel2 or qmLevel3) enqueues them and sends them sequentially from the connection thread, avoiding locks when several threads call WriteData or Ping at once. Messages at qmLevel1 are processed before qmLevel2, and qmLevel2 before qmLevel3, 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.
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;