On Tue, Jul 29, 2014 at 4:10 PM, Lucas Holmquist <lholmqui@redhat.com> wrote:

so this sort of relates to this thread here:

http://aerogear-dev.1069024.n5.nabble.com/aerogear-dev-Differences-between-Firefox-OS-quot-native-quot-Push-lib-and-AeroGear-s-Push-adapter-td6195.html



from
 https://developer.mozilla.org/en-US/docs/Web/API/Simple_Push_API#Add_the_push_message_handler
Moz example

window.navigator.mozSetMessageHandler('push', function(e) {
    console.log('My endpoint is ' + e.pushEndpoint);
    console.log('My new version is ' +  e.version);
    //Remember that you can handle here if you have more than
    //one pushEndpoint
    if (e.pushEndpoint === emailEndpoint) {
        emailHandler(e.version);
    } else if (e.pushEndpoint === imEndpoint) {
        imHandler(e.version);
    }
});

The notification that they send back includes the pushEndpoint and the version


Using the little hack, I am not seeing the pushEndpoint being returned by their server:
https://gist.github.com/matzew/cbda360d72eaaef75971




 

Currently, when we do navigator.push.register() the result we send back is an object that includes the pushEndpoint, this is actually changing to be more in line with Mozilla. Instead of the object being sent back, we will send back the pushEndpoint as a String. <--- is a super easy change that sebi already did, just need to re-merge it back in

but in our message handler, our notification that is sent back includes the channelId and version


here is, the JSON I receive w/ the above hack:
{"messageType":"notification","updates":[{"channelID":"d9b74644-4f97-46aa-b8fa-9393985cd6cd","version":3}]}

 

I believe the server should now be sending the pushEndpoint in the notification instead.

I'd do it myself, but you know, it's java


_______________________________________________
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