TsgcHTTP3Client › Events › OnGoAway
Fires when the server sends a GOAWAY frame announcing a graceful shutdown.
TsgcHTTP3GoAwayEvent = procedure(Sender: TObject;
aStreamId: Int64) of object;
property OnGoAway: TsgcHTTP3GoAwayEvent read FOnGoAway write FOnGoAway;
| Name | Type | Description |
|---|---|---|
Sender | TObject | The TsgcHTTP3Client instance that raised the event. |
aStreamId | Int64 | The highest request stream ID the server may still process. Requests on streams with a higher ID have not been handled and can safely be retried on a new connection. |
GOAWAY (RFC 9114 Section 5.2) is how a server announces that it is shutting the connection down gracefully, typically for a restart or a load-balancer drain. The frame arrives on the server control stream and moves the connection to the GoAway state.
Requests already in flight on streams up to aStreamId are still being processed and will complete normally. Anything above it was rejected and must be retried on a fresh connection, which is the point of the parameter: it tells you exactly what was lost.
Do not start new requests on this connection after the event. Open a new connection instead, then let the old one finish its outstanding work. OnDisconnect follows once the server actually closes.
procedure TfrmMain.OnGoAwayEvent(Sender: TObject; aStreamId: Int64);
begin
Log(Format('GOAWAY, last stream id: %d', [aStreamId]));
end;