TsgcWebSocketServer_HTTPAPI › Events › OnAsynchronous
Fires when an asynchronous send operation initiated by the HTTP API server has completed.
property OnAsynchronous: TsgcWSHTTPAPIAsynchronousEvent;
// TsgcWSHTTPAPIAsynchronousEvent = procedure(Sender: TObject; var aConnection: TsgcHTTPAPIContext; var Handled: Boolean) of object
—
When the Asynchronous property is True, messages written to a client do not block the calling thread: the IOCP worker queues the send and returns immediately, and HTTP.SYS signals completion later. OnAsynchronous is raised for every completed async operation so the application can release or reuse the underlying buffers. The aConnection parameter points to the TsgcHTTPAPIContext associated with the completed request; set Handled to True when the application has already disposed of the context to prevent the component from running its default cleanup. If Asynchronous is False (the default) this event is never raised.
procedure OnAsynchronous(Sender: TObject; var aConnection: TsgcHTTPAPIContext;
var Handled: Boolean);
begin
DoLog('async write completed');
Handled := False;
end;