Hi,
While playing today with my Firefox Device and its native Simple Push support I noticed  some differences between our implementation and the native Push regarding the success callback after a register : 


//Native FFOS Push broadcastRequest = navigator.push.register(); broadcastRequest.onsuccess = function (event) { broadcastEndpoint = broadcastRequest.result; // only contains the pushURL } //Aerogear Push Adapter broadcastRequest = navigator.push.register(); broadcastRequest.onsuccess = function (event) { broadcastEndpoint = broadcastRequest.result.pushEndpoint; channelID = broadcastRequest.result.channelID; version = broadcastRequest.result.version; status = broadcastRequest.result.status }
So, the AeroGear Push exposes much more in the callback that it should suppose to do : just exposing the pushEndpoint.

The reason we do that I suppose, but Luke or Kris could confirm that, is that we thought respecting the SPS protocol, which indeed returns a whole object containing all the info. It is just that the Native Push Client API filter that out in the callback response.
After discussing that on the #push channel with the Mozilla people they confirmed me that we should only expoe the pushEndpoint.

If we keep it as is, this can be problematic when we want to use the same code both for native and with the adapter when, for instance, registering to the UPS : 

broadcastRequest = navigator.push.register();
broadcastRequest.onsuccess = function (event) {
      broadcastEndpoint = event.target.result;
      var broadCastSettings = {
          metadata: {
              deviceToken: broadcastEndpoint.channelID,
              simplePushEndpoint: broadcastEndpoint.pushEndpoint  
          }          
       }
     UPClient.registerWithPushServer(broadCastSettings);
}

 
This won't work with the native push since "broadcastEndpoint.channelID" will be undefined. 

So I propose that we change the behaviour, to return only the pushEndpoint in the callback, even if that means a bit of String manipulation when we want to perform the registration to the UPS : 

var broadCastSettings = {
        metadata: {
            deviceToken: broadcastEndpoint.substr(broadcastEndpoint.lastIndexOf('/') + 1),
            simplePushEndpoint: broadcastEndpoint
                   }
         }

wdyt ?

Seb


ps : our SPS Server implementation stays correct and returns what should be returned, it's really just the client part and how we expose the result