-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix: Push Notification corner cases #186
Conversation
df3c40e
to
592f7a8
Compare
592f7a8
to
71fabef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made a pre-review not digging into the purpose of these changes.
71fabef
to
ac1ad59
Compare
If we're |
@paddybyers no, right now spec says that on |
So stale/invalid deviceId etc can exist in the That sounds wrong to me. The whole point of having a state machine is that the state characterises everything to do with what future events should be. Do you think deleting unused device details should happen on any transition to |
I can't find the code path leading to
Should be similar on Android I guess? @ttypic |
You can be in Also if you take a look at spec and how
I don't think so, because |
But in these two cases the previous state is not |
@maratal Yes, but the previous state doesn't matter. We were discussing path leading to |
Having thought about this PR a bit more broadly, I do agree with @paddybyers that having any device push state while in the |
After thoroughly examining our Push Notification flow, I have built a diagram, and some of the problems have become clear.
We can't ignore
CalledDeactivate
event when we are inNotActive
stateCurrently, we are ignoring the
CalledDeactivate
event when we are in theNotActive
state, which causes a lot of problems later on.Example:
NotActive
with valid device identity token (e.g. haven't received registration update).clientId
calls activate and get errorclientId mismatch
We shouldn't use token / key auth during deregistration call
Users potentially can change apps, and we can handle this by relying solely on device token authentication during the deregistration call; otherwise, we might end up in a broken state.
Example:
If we use device token auth together with token or key auth from another Ably app we'll receive
Token unrecognised
error.We should handle unauthorized errors or other problems with device identity token
When we encounter
401
status errors or code40005
errors (invalid credentials), we should treat them as successful deregistrations and clear local storage. Otherwise, the device may remain in a broken state. If device identity token for some reason got invalid, broken or revoked we end up in permanent broken state.