-
Notifications
You must be signed in to change notification settings - Fork 226
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
Multiple notifications while disconnected #28
Comments
Hey I just fixed this in a branch I will push soon. :) |
I'm running into a similar issue. I did verify that the #28 fix is in the v50 branch I'm working with. In the case I'm hitting it, our server is in very rapid succession we are calling pypans twice. Once with a token that will be rejected on production and once with a token it will like. These calls are separate and not part of a notify call with multiple items. My thought had been that perhaps we would use the batch later, but for now we would be safer and just call for each token and treat the feedback and disconnect as almost the same thing. In any case, here's the resulting log:
I was expecting that notifications sent as separate requests would not be affected by a prior disconnect, but only none of the notifies make it out. In any case, I'll be spending some time looking into this today. I could very easily be mistaken about what the expected behavior is. It would also be helpful to get a little doc up that explains the expected use of the disconnects log (in v50). |
I don't have much familiarity with twisted and hence the guts of transport or any of it, but seems like there is a window of opportunity where close calls like this will end up being lost when the connection is closed down with an invalid token. It's also unclear to me when I read the apple docs if it is expected behavior to drop all of the received data (send no notifications) when closing the connection due to an invalid token. Do you have any insight? |
I did find a reply in the dev forums to the final question, they accept all items before to the bad item. |
I'm running into this same issue. I think the situation is this: if pyapns sends two messages to Apple's servers in one connection, and the first of the two is "bad" and will be rejected by Apple, then the second one fails to send and we get the connection dropped, with a message indicating that "data received after sendMessage data=xxxx". Is there a solution to this issue? |
When APNS connection is not established you defer sending the notification with this line:
d.addCallback(lambda p: p.sendMessage(notifications))
When sending multiple notifications those callbacks are chained and second one fails because first one doesn't return p. I think it should be:
def connected(protocol):
protocol.sendMessage(notifications)
return protocol
d.addCallback(connected)
The text was updated successfully, but these errors were encountered: