As I work more and more toward aligning with the API spec laid out by Mozilla for
SimplePush, I find myself needing to make a major change to the way we have implemented
channel registrations. Basically what I have found is that our storage and reuse of
channels between app restart/refresh, though meant to be an improvement to performance, is
causing more issues than it's solving.
The Proposal
I would like to only persist the user agent id (UAID) in storage and only keep the channel
registrations in memory while the app is running. Each time the app starts up, the
workflow would be:
First Start
Client Hello => Server
Server Ack => Client
Client 1 or more channel registrations => Server
Server stores channel and sends pushEndpoint => Client
Client registers endpont => App Server or UP Server
Push messages abound
Restart / Refresh
Client Hello => Server
Server recognizes UAID and since no channels were included in Hello, all existing channels
are removed as per the spec and sends Ack => Client
Client 1 or more channel registrations => Server
Server stores channel and sends pushEndpoint => Client
Client registers endpont => App Server or UP Server
Push messages abound
The only possible downside I see here is there will be slightly more chatter over the
network since the registrations will happen every time the app loads. There should be no
performance decrease and may see a performance boost since we will be eliminating a number
of synchronous calls into localStorage. The main benefit is that this will allow us to
almost completely synchronize our API with Mozilla's which would then allow for
immediate use of one of our apps as a web app and Firefox OS app with NO modifications.
Any thoughts?