TsgcHTTP2ClientEvents › OnHTTP2GoAway

OnHTTP2GoAway Event

Fires when the server sends a GoAway frame signalling the connection is being shut down.

Syntax

property OnHTTP2GoAway: TsgcHTTP2ClientGoAwayEvent;
// TsgcHTTP2ClientGoAwayEvent = procedure(Sender: TObject; const Connection: TsgcHTTP2ConnectionClient; const GoAway: TsgcHTTP2GoAwayProperty) of object

Default Value

Remarks

OnHTTP2GoAway is raised when the server sends a GOAWAY frame to announce that it will stop accepting new streams on the connection, typically because it is being restarted, overloaded, or enforcing a graceful shutdown. The GoAway parameter exposes the last stream identifier the server processed, the HTTP/2 error code and any additional debug data returned by the peer, so the application can tell which in-flight requests were completed and which ones need to be retried on a new connection. The event is informational: the client still finishes the already accepted streams and will close the connection afterwards.

Example


procedure OnHTTP2GoAwayEvent(Sender: TObject; const Connection: TsgcHTTP2ConnectionClient;
  const GoAway: TsgcHTTP2GoAwayProperty);
begin
  Log(Format('GoAway received: last stream %d, error %d',
    [GoAway.LastStreamId, GoAway.ErrorCode]));
end;

Back to Events