-
Notifications
You must be signed in to change notification settings - Fork 47
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
Asynchronous send results in exiting before all notifications are sent #50
Comments
Are these the reasons why my following code only sends to the first device token in an array of tokens?
Changing "sender.Send(notification)" to "go sender.Send(notification)" does not work as well. Found another Apple Push Notification Go library apns.go while looking for examples of sending multiple push with this library, and I will be trying it next. |
Try removing the
And let me know what you find! I'm guessing there could be an error with the second token. |
Hi @tylrtrmbl, I have followed your instructions, and there is no difference. I have even included the following sample code from error handling section of current project's main Github page, and it is not logging any errors as well:
With Go, a new language designed to be concurrent, I do not expect individual I/O errors to be interfering with other simultaneous I/O operations. |
Refactoring my code to the following will achieve sending to all tokens in the array:
Using "go sender.Send(notification)" will make the performance better at around 160ms per connection versus "sender.Send(notification)" at around 900ms per connection. |
@joelchen I would suggest something inbetween those two versions. Create a NewPayload for each iteration of the loop, but only create a NewClient once. |
Hi @nathany, I have tried moving NewClientWithFiles out of the loop, and it does not work as well. The best I could do is to move NewNotification and NewPayload out of the loop. |
Hi @joelchen If the code above is the entirety of your program running in |
Thanks Courtland. |
Hi @CourtF, Looking forward to have the develop branch merged into master branch. |
I'm afraid it's still a ways off. Still trying to figure out the error handling when moving to synchronous writes. |
It's clear that:
TCP_CORK
-like implementation of sending APNS messagesIn my mind, these are all closely intertwined with throughput. Any of these can be solved very easily at the expense of throughput. With high throughput in mind, these become more challenging to address. :)
This issue is a teaser. I have some ideas, but I'm going to wait until we're finished nailing down #31 before opening that bucket of worms. That way we can avoid the API moving every which way at once.
Forgive me,
@tylrtrmbl
The text was updated successfully, but these errors were encountered: