delphixe apns Remote Push error:Connection Closed Gracefully

function TFormMain.HttpPost(IdHTTP1: TIdHTTP; sJsonData, sUrl: string): string; var jsonToSend: TStringStream; begin try IdHTTP1.HTTPOptions := IdHTTP1.HTTPOptions + [hoKeepOrigProtocol]; //必须有这行才使设置协议版本生效 IdHTTP1.ProtocolVersion := pv1_1;

IdHTTP1.Request.CustomHeaders.Values[':method']:='POST';
IdHTTP1.Request.CustomHeaders.Values[':path']:='/3/device/' + EditDeviceToken.Text;
IdHTTP1.Request.CustomHeaders.Values[':scheme']:='https';
IdHTTP1.Request.CustomHeaders.Values['apns-push-type']:='background';
IdHTTP1.Request.CustomHeaders.Values['host']:='api.push.apple.com';

IdHTTP1.Request.CustomHeaders.Values['apns-topic']:='com.xxvar.erp';
IdSSLIOHandlerSocketOpenSSL1.SSLOptions.CertFile:='d:\WIN\APNS-cert.pem';
IdSSLIOHandlerSocketOpenSSL1.SSLOptions.KeyFile:='d:\WIN\APNS-key.pem';
IdSSLIOHandlerSocketOpenSSL1.ssloptions.method:= sslVSSLv23;
IdSSLIOHandlerSocketOpenSSL1.ssloptions.Mode:= sslmBoth;
with IdHTTP1 do
begin
  IOHandler := IdSSLIOHandlerSocketOpenSSL1;
  HandleRedirects := True; //允许头转向
  ReadTimeout := 5*60*1000; //请求超时设置
  Request.ContentType := 'application/json'; //x-www-form-urlencoded
  Request.ContentEncoding := 'utf-8';
  try
    jsonToSend := TStringStream.Create(UTF8Encode(sJsonData));
    jsonToSend.Position := 0; //将流位置置为0
    Memo1.Lines.Add('发送指令执行结果到集抄平台: ' + sJsonData);
    Result:= Post(sUrl, jsonToSend);
    Memo1.Lines.Add(Result);//Result := HTTPDecode(Post(sUrl, jsonToSend)); //接收POST后的数据返回
  except
    on e: Exception do
    begin
      Memo1.Lines.Add('接口调用异常: ' + e.Message);
      jsonToSend.free;
    end;
  end;
end;

finally end; end;

The only requests we see for the topic you listed here are for the retired legacy HTTP/1 interface.

I can't comment on what this code does, but we have no correct HTTP/2 requests made in the last 24 hours.

This requires you to migrate your push servers to use the HTTP/2 API. Any push servers still using the legacy interface will be unable to connect to APNs, resulting in these disconnections

More information about the HTTP/2 provider API can be found in these two WWDC sessions:

You can read more about the new APNs Provider API here: https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns/

If you have issues after migrating to the new interface, or have technical questions about the migration, we are happy to help troubleshoot your push requests once you have started using the HTTP/2 protocol. Please understand that we are unable to help with the specifics of your server side implementation.

delphixe apns Remote Push error:Connection Closed Gracefully
 
 
Q