TsgcHTTP2Client | HTTP/2 Partial Responses

일반적으로 HTTP 요청을 전송하면 서버는 요청된 파일과 함께 응답을 전송합니다. 때때로 단일 응답을 전송하는 대신 서버는 스트림처럼 여러 응답을 전송할 수 있습니다. 이러한 경우 OnHTTP2ResponseFragment 이벤트를 사용하여 이러한 응답을 캡처하고 사용자에게 표시할 수 있습니다.

 

예제: https://http2.golang.org/clockstream에 요청을 보내면 서버가 매초마다 스트림 응답을 보냅니다.

 


TsgcHTTP2Client *oClient = new TsgcHTTP2Client();
oClient->OnHTTP2ResponseFragment = OnHTTP2ResponseFragmentEvent;
oClient->Get("https://http2.golang.org/clockstream");
...
void OnHTTP2ResponseFragmentEvent(TObject *Sender, const TsgcHTTP2ConnectionClient *Connection, 
  const TsgcHTTP2RequestProperty *Request, const TsgcHTTP2ResponseFragmentProperty *Fragment)
{
  ShowMessage(Fragment->DataString);
}