我有一个用 PHP 编写的 Web 服务,一个 iPhone 应用程序连接到该服务。当应用程序调用该服务时,一系列通知消息会发送到 Apple 的 APNs 服务器,以便它可以向应用程序的其他用户发送推送通知。
在某些情况下,此过程可能会很耗时,并且我的应用程序必须等待很长时间才能获得响应。响应完全独立于发送到 APNs 服务器的通知消息的结果。
因此,我希望 Web 服务将响应发送回应用程序,无论是否已向 APNs 发送消息。
我当前的代码:
<?
<...>
echo $chatID; // This has to be printed immediately
include('apns.php'); // Just invoke this, dont wait for response!
?>
我该怎么做呢?