parse-community / parse-server-push-adapter

A push notification adapter for Parse Server
https://parseplatform.org
MIT License
87 stars 99 forks source link

apns never reports numFailed in _PushStatus. #55

Closed jeacott1 closed 7 years ago

jeacott1 commented 7 years ago

GCM works fine in this regard, and properly reports success/failures, but apns never updates the tracker on fail. log:

verbose: sending push to 1 installations
  apn Socket drained 1 +4s
  apn 0 left to send +0ms
verbose: sent push! 1 success, 0 failures
  apn 0 left to send +5ms
  apn Notification 0 caused an error: 5 +275ms
ERR! parse-server-push-adapter APNS cannot find vaild connection for xxxxxxxx
  apn Raising error: 5 { encoding: 'utf8',
  payload: 

corresponding _PushStatus ("numFailed" : 0)

{ "_id" : "V4J5VKGvQf", "pushTime" : "2017-02-08T00:38:25.616Z",
 "query" : "{\"objectId\":\"8BHXqhukp5\"}", 
"payload" : "{\"alert\":\"just a test\"}", 
"source" : "rest", "status" : "succeeded", "numSent" : 1, 
"pushHash" : "cddc3a1fd8d20707a0ff8b839a60737a",
 "_wperm" : [ ], "_rperm" : [ ],
 "_acl" : {  }, "_created_at" : ISODate("2017-02-08T00:38:25.616Z"), 
"_updated_at" : ISODate("2017-02-08T00:38:28.645Z"),
 "numFailed" : 0, "sentPerType" : { "ios" : 1 } }
flovilmart commented 7 years ago

uhm, seems that because APNS support multiple 'connections' we don't track if it's the last try. Also successful push does not mean delivery, hopefully we'll have something with #52 :)

jeacott1 commented 7 years ago

successful push for gcm means no failure response from gcm. why shouldnt it be the same behaviour for apns? the apns adapter assumes that if its sent something to the apns service its all good, despite any transmissionError.

flovilmart commented 7 years ago

yeah but APNS behaves differently from GCM, transmission to APNS doesn't mean it's gonna be delivered hence the feedback service.

Not sure how GCM handles it but from what I saw, it seems to be fairly transactional.

In any case, feel free to provide a fix for that issue.

jeacott1 commented 7 years ago

agreed, but both return failures when they can. I'll see what I can do. javascript isn't fun.

flovilmart commented 7 years ago

The main difference is that we support multiple connections for APNS not for GCM IIRC. So we have to check for APNS and keep track of transient failures.

jeacott1 commented 7 years ago

looks like apn v2 should make this easier, no more transmitted firing before transmittionError, just plain success/fail.

jeacott1 commented 7 years ago

actually, #52 fixes the issue, and is significantly faster than the existing version while its at it, so roll it in asap please :)

flovilmart commented 7 years ago

Yes, because APNSv2 is transactional and not fire and forget

flovilmart commented 7 years ago

apns v2 will be parse of parse-server 2.5.1, which is currently being built. Closing.