TsgcWebSocketClient › Events › OnSendBufferFull
Fires when the outbound message queue has reached QueueOptions.MaxQueueSize, before the overflow policy is applied.
property OnSendBufferFull: TsgcWSSendBufferFullEvent;
// TsgcWSSendBufferFullEvent = procedure(Connection: TsgcWSConnection; const QueueSize: Integer; var DropMessage: Boolean) of object
—
Only fires when message queuing is active and QueueOptions.MaxQueueSize is greater than zero: every time a message is about to be enqueued while the queue already holds MaxQueueSize messages, this event is raised with the current QueueSize. DropMessage arrives as True; leave it unchanged to let QueueOptions.OverflowPolicy decide what happens (qopDropOldest discards the oldest queued message, qopDropNewest discards the new message, qopDisconnect discards it and closes the connection), or set it to False to accept the message anyway and let the queue grow beyond the limit. Use this event to detect backpressure, for example to pause producers or log slow-consumer conditions.
procedure OnSendBufferFull(Connection: TsgcWSConnection; const QueueSize: Integer;
var DropMessage: Boolean);
begin
WriteLn('#send buffer full: ' + IntToStr(QueueSize) + ' messages queued');
end;