On Fri, Jul 26, 2013 at 4:15 PM, Kris Borchers <kris.borchers@gmail.com> wrote:
Hey all,

Before I make a change to this polyfill I wanted to make sure there were no concerns or objections. Basically, what I want to do is change the usage so that calls to navigator.push.register() or navigator.push.registrations() (not yet added) would have to be done after a connection is established.

+1 that makes perfectly sense - the users will be 'notified' of an established connection, right ? 

 
Currently, a user can call either of those methods at any time which causes headaches when trying to account for registrations that happen before the connection and also register previously used channels stored in localStorage. Just as an FYI, this is not an issue for Mozilla because they already know they have a connection when their JS executes because the browser creates the connection during startup.

yeah - and in case of FFOS, the connection to their SP server is already there. They serve all SP apps over one WebSocket connection (similar to APNs and Google's persistent connection).

 
I have done a LOT of work to try to account for race conditions which may occur and in the process added a LOT of extra code.

I hear you :-)
 
And even with all of that work, I'm still not 100% sure that all race conditions have been accounted for once this code is used at scale with lots of connec!
 tions.

So what am I suggesting? I would like to require our users to create a connection to the SimplePush server and do their interactions with that server in the success (or onConnect or what ever we want to call it) callback.


+9001 
 
After that, all code would be identical to the Mozilla APIs.

that is the key. We are a slightly different environment, so setting these 'requirements' is more than reasonable! 

 
Then, we could just write a brief guide or tutorial on transitioning code between our implementation and Mozilla's to highlight the small difference.

yes - makes all perfectly sense
 

Thoughts?
_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev



--
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf