TsgcHTTP2Client | HTTP/2 Partial Responses

Genellikle bir HTTP İsteği gönderdiğinizde, sunucu istenen dosyayla bir yanıt gönderir, bazen tek bir yanıt göndermek yerine sunucu bir akış gibi birden çok yanıt gönderebilir; bu durumlarda bu yanıtları yakalamak ve kullanıcıya göstermek için OnHTTP2ResponseFragment olayını kullanabilirsiniz.

 

Örnek: https://http2.golang.org/clockstream adresine bir istek gönderin ve sunucu her saniye bir akış yanıtı gönderecektir.

 


oClient := TsgcHTTP2Client.Create(nil);
oClient.OnHTTP2ResponseFragment := OnHTTP2ResponseFragmentEvent;
oClient.Get('https://http2.golang.org/clockstream');
...
procedure OnHTTP2ResponseFragmentEvent(Sender: TObject; const Connection: TsgcHTTP2ConnectionClient; 
  const Request: TsgcHTTP2RequestProperty; const Fragment: TsgcHTTP2ResponseFragmentProperty);
begin
  ShowMessage(Fragment.DataString);
end;