-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ios - if one DeviceToken are wrong no push are sent #713
Comments
Can confirm that, did cost me some time some days ago. Sending one push after another now until this is fixed. |
Same for me sending one push at time, very time consuming... |
Same problem here. |
How do you send one at time rather than using the queue? |
I,m on vaccation. Back on July 11th Regards, |
I can't access my code at the moment. But I think there was a method SetScale to send one at time. |
Any news on this? Its really a show-stopper. Sending 150 notifications to iOS devices will take minutes sending one after another. |
Any news on this? |
Any updates on this?? I have Same problem |
Hi, we faced with same Invalid Token problem, please help with it |
Same problem, any news on this? |
I am using the following workaround: var config = new ApnsConfiguration(eApnsEnvironment, certificatePath, apnsCertPassword);
// This is a temporary solution for this issue:
// https://github.com/Redth/PushSharp/issues/713
config.InternalBatchSize = 1; Which bypases the Apns connection batches and sends notifications one by one. The problem is caused by the following code in ApnsConnection.cs, line 160. Foreach loop sets all items in the batch failed. ...
} catch (Exception ex) {
Log.Error ("APNS-CLIENT[{0}]: Send Batch Error: Batch ID={1}, Error={2}", id, batchId, ex);
foreach (var n in toSend)
n.CompleteFailed (new ApnsNotificationException (ApnsNotificationErrorStatusCode.ConnectionError, n.Notification, ex));
}
... |
Looking at the current Reader code.. it does send the InvalidToken exception to us and then re-enqueues ALL the ones AFTER the failed one in the batch... and thus tries the later ones again. I found setting the batch size to 1 is not a good solution for a system that needs to send many requests at once. Still trying to see what the root issue is... I did change the code in the connection send.... to handle a bad socket and retry better... not sure if this helps
|
This is a temporary change to code for sending all Succeed Notifications in batch.
|
same here |
Still, there are no updates :( |
for the time being i am just doing a check on each device before adding it to queue |
Opps. I tried to open a lot of brokers to APN but it seems it blocks you (your IP etc) if you that. So do not try to open a lot of connections :) I simply removed invalidTokens at once from db if encounter any, and set config.InternalBatchSize to 99. That seems to solve to problem and sended a thousand notifications in instant. I would update here later if our user count increases :) |
I made a pull request to fix this issue. If you are still experiencing this issue you can try my code to fix it. pull request: #877 |
If I send a batch of notifications and one of the DeviceToken are wrong the correct ones dont sends. . I am using demo code of push sharp for batch of notifications. example, I am send 100 device tokens and there is in the list first and last are correct. so i am getting only first pushnotification and last(100) not getting. Please let me know what was the solution of this problem. |
@kalpesh-jariwala #885 was created to solve this issue. I am not sure why it hasn't been merged but you could download or fork https://github.com/chillNZ/PushSharp and build it yourself |
v.4.0.10.0
Problem
If I send a batch of notifications and one of the DeviceToken are wrong the correct ones dont sends,
Try it
send a batch with two DeviceToken one wrong and one correct, and you dont get the correct pushnotification either
Exception
2016-05-31 17:18:14. [DEBUG] Scaled Changed to: 1
2016-05-31 17:18:14. [INFO] Stopping: Waiting on Tasks
2016-05-31 17:18:14. [INFO] Waiting on all tasks 2
2016-05-31 17:18:15. [INFO] APNS-Client[1]: Sending Batch ID=1, Count=2
2016-05-31 17:18:15. [ERROR] APNS-CLIENT[1]: Send Batch Error: Batch ID=1, Error=PushSharp.Core.NotificationException: Invalid DeviceToken
at PushSharp.Apple.ApnsNotification.ToBytes()
at PushSharp.Apple.ApnsConnection.createBatch(List`1 toSend)
at PushSharp.Apple.ApnsConnection.d__21.MoveNext()
2016-05-31 17:18:15. [INFO] APNS-Client[1]: Sent Batch, waiting for possible response...
2016-05-31 17:18:15. [ERROR] APNS-Client[1]: Reader Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at PushSharp.Apple.ApnsConnection.d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at PushSharp.Apple.ApnsConnection.d__21.MoveNext()
2016-05-31 17:18:15. [INFO] APNS-Client[1]: Done Reading for Batch ID=1, reseting batch timer...
Apple Notification Failed: ID=1, Code=ConnectionError
Apple Notification Failed: ID=2, Code=ConnectionError
2016-05-31 17:18:15. [INFO] All Tasks Finished
2016-05-31 17:18:15. [INFO] Passed WhenAll
2016-05-31 17:18:15. [INFO] Broker IsCompleted
2016-05-31 17:18:15. [DEBUG] Broker Task Ended
2016-05-31 17:18:15. [INFO] Stopping: Done Waiting on Tasks
Code
// Wire up events
apnsBroker.OnNotificationFailed += (notification, aggregateEx) =>
{
string error = string.Empty;
aggregateEx.Handle(ex =>
{
The text was updated successfully, but these errors were encountered: