1

The push works just fine, the problem is that the feedback is empty. I need to delete the tokens that have expired or have an invalid status.This is what I write test code,this a problem?]

$ctx = stream_context_create(); 
stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem'); 
$fp = stream_socket_client('ssl://feedback.sandbox.push.apple.com:2196', $error, $errorString, 60, STREAM_CLIENT_CONNECT, $ctx); 
if (!$fp) { 
  return; 
} 
while ($devcon = fread($fp,38)) { 
  $arr = unpack("H*", $devcon); 
  $rawhex = trim(implode("", $arr)); 
  $feedbackTime = hexdec(substr($rawhex, 0, 8)); 
  $feedbackDate = date('Y-m-d H:i', $feedbackTime); 
  $feedbackLen = hexdec(substr($rawhex, 8, 4)); 
  $feedbackDeviceToken = substr($rawhex, 12, 64); 
} 
fclose($fp);
Raptor
  • 53,206
  • 45
  • 230
  • 366
Dinel xu
  • 9
  • 3
  • Can you show us your codes, request (contents you wrote in SSH tunnel) and response ? – Raptor May 16 '13 at 09:59
  • $ctx = stream_context_create(); stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem'); $fp = stream_socket_client('ssl://feedback.sandbox.push.apple.com:2196', $error, $errorString, 60, STREAM_CLIENT_CONNECT, $ctx); if (!$fp) { return; } while ($devcon = fread($fp,38)) { $arr = unpack("H*", $devcon); $rawhex = trim(implode("", $arr)); $feedbackTime = hexdec(substr($rawhex, 0, 8)); $feedbackDate = date('Y-m-d H:i', $feedbackTime); $feedbackLen = hexdec(substr($rawhex, 8, 4)); $feedbackDeviceToken = substr($rawhex, 12, 64); } fclose($fp); – Dinel xu May 17 '13 at 00:47

1 Answers1

2

Feedback services don't always return data. You will get data only if there is need to report failed deliveries.

See the documentation here.

Not sure if this is true but I have noticed feedback services don't work with the sandbox environment (at least I haven't received a response any time I checked with sandbox)

lostInTransit
  • 70,519
  • 61
  • 198
  • 274