<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 6, 2014 at 3:11 PM, Sebastien Blanc <span dir="ltr">&lt;<a href="mailto:scm.blanc@gmail.com" target="_blank">scm.blanc@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Thu, Feb 6, 2014 at 12:28 PM, Matthias Wessendorf <span dir="ltr">&lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">

<div><div>On Wed, Feb 5, 2014 at 11:52 PM, Matthias Wessendorf <span dir="ltr">&lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">


<div>On Wed, Feb 5, 2014 at 11:22 PM, Sebastien Blanc <span dir="ltr">&lt;<a href="mailto:scm.blanc@gmail.com" target="_blank">scm.blanc@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi,<div>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 : </div>




<div><br></div><div><pre style="background-color:rgb(248,248,248);border-top-left-radius:3px;margin-bottom:15px;padding:6px 10px;line-height:19px;border-top-right-radius:3px;font-size:13px;overflow:auto;border-bottom-right-radius:3px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:normal;border:1px solid rgb(221,221,221);border-bottom-left-radius:3px;margin-top:0px!important">
<code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal"><br>





//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   
 }
</code></pre></div><div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal">So, the AeroGear Push exposes much more in the callback that it should suppose to do : just exposing the pushEndpoint.</code></div>




<div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal"><br>




</code></div><div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal">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.</code></div>



</div></blockquote><div><br></div><div><br></div></div><div>Did they change that recently? Or was theirs always like it is now ?</div><div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



<div dir="ltr">
<div>After discussing that on the #push channel with the Mozilla people they confirmed me that we should only expoe the pushEndpoint.</div></div></blockquote><div><br></div><div><br></div></div><div>yep, I agree on changing our JS polyfil </div>


<div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal"><br>




</code></div><div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal">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 : </code></div>




<div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal"><br>




</code></div><div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal"><pre style="background-color:rgb(248,248,248);border-top-left-radius:3px;margin-bottom:15px;padding:6px 10px;line-height:19px;border-top-right-radius:3px;font-size:13px;overflow:auto;border-bottom-right-radius:3px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:normal;margin-top:15px;border:1px solid rgb(221,221,221);border-bottom-left-radius:3px">
<code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal">broadcastRequest = navigator.push.register();
broadcastRequest.onsuccess = function (event) {
      broadcastEndpoint = event.target.result;
      var broadCastSettings = {
          metadata: {
              deviceToken: broadcastEndpoint.channelID,
              simplePushEndpoint: broadcastEndpoint.pushEndpoint  
          }          
       }
     UPClient.registerWithPushServer(broadCastSettings);
}</code></pre></code></div><div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal"><br>




</code></div><div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal"> </code></div>




<div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal">This won&#39;t work with the native push since &quot;</code><span style="font-size:12px;background-color:transparent;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace">broadcastEndpoint.channelID&quot; will be undefined. </span></div>



</div></blockquote><div><br></div></div><div>sweet :-) </div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div dir="ltr">
<div><span style="font-size:12px;background-color:transparent;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace"><br></span></div><div><span style="font-size:12px;background-color:transparent;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace">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 : </span></div>




<div><span style="font-size:12px;background-color:transparent;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace"><br></span></div><div><pre style="background-color:rgb(248,248,248);border-top-left-radius:3px;margin-bottom:15px;padding:6px 10px;line-height:19px;border-top-right-radius:3px;font-size:13px;overflow:auto;border-bottom-right-radius:3px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:normal;margin-top:15px;border:1px solid rgb(221,221,221);border-bottom-left-radius:3px">
<code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal">var broadCastSettings = {
        metadata: {
            deviceToken: broadcastEndpoint.substr(broadcastEndpoint.lastIndexOf(&#39;/&#39;) + 1),
            simplePushEndpoint: broadcastEndpoint
                   }
         }</code></pre></div><div><span style="font-size:12px;background-color:transparent;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace"><br></span></div></div></blockquote><div><br></div></div><div>well, that&#39;s not really good for security reasons, since their looooong &#39;substring&#39; was done for that. Also that&#39;s just redundant.</div>



<div><br></div><div>The I guess, the deviceToken (channelID registration) might be a bit bogus, for SimplePush. Let me think about it....<br></div></div></div></div></blockquote><div><br></div><div><br></div></div></div>

<div><div>Right now we use the channelID as the deviceToken, but we should not really &#39;leak&#39; the channelID (see [1]), so I guess the here proposed change makes sense. Don&#39;t recall exactly why we did it in the past, but yeah - let&#39;s change it.</div>


<div><br></div><div><br></div><div>Thinking about the consequence: I think we should use store the value of the returned &#39;pushEndpoint&#39; string as our device-token. At the end the device-token is really the thing that identifies a device w/in the target network. Apple/Google uses a unique string, and if Mozilla uses a URL, that&#39;s totally fine.</div>


<div><br></div><div>Reading the protocol definitions (see [1]) for the &#39;endpoint&#39; I think it is fair to use that (unique) URL string as the device-token; And we could use this token value as well for the unregister calls, instead of the channelIDs. </div>

</div></div></div></div></blockquote><div><br></div></div></div><div>After reading your comment  on the PR <a href="https://github.com/aerogear/aerogear-js/pull/105#issuecomment-34324732" target="_blank">https://github.com/aerogear/aerogear-js/pull/105#issuecomment-34324732</a> I understand that you just want to use the deviceToken and not pass the simplePushEndpoint to UPS anymore, is that right ? </div>
</div></div></div></blockquote><div><br></div><div><br></div><div>yep</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">

<div>
<div><br></div><div><br></div><div>Any thoughts ? </div><div><br></div><div><br></div><div>-Matthias</div><div><br></div><div>[1] <a href="https://wiki.mozilla.org/WebAPI/SimplePush/Protocol#Definitions" target="_blank">https://wiki.mozilla.org/WebAPI/SimplePush/Protocol#Definitions</a><br>


</div></div><div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div dir="ltr">
<div class="gmail_extra"><div class="gmail_quote"><div></div><div><br></div><div>That said, we still have no clue how to proper clean-up &#39;out dated&#39; channels, since the SimplePush Server/Protocol is silent on that (unlike APNs / GCM). but that&#39;s really a different thread (yep, we have a future JIRA for that)<br>



</div><div><br></div><div><br></div><div>-M</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div><div dir="ltr"><div><span style="font-size:12px;background-color:transparent;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace"></span></div>
<div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal">wdyt ?</code></div>




<div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal"><br>




</code></div><div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal">Seb</code></div>




<div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal"><br>




</code></div><div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal"><br>




</code></div><div><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal">ps : our SPS Server implementation stays correct and returns what should be returned, it&#39;s really just the client part and how we expose the result</code></div>




<div><br></div></div>
<br></div>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><span><font color="#888888"><br></font></span></blockquote></div><span><font color="#888888"><br>


<br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br>
<br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>



twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</font></span></div></div>
</blockquote></div></div><div><br><br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>

sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div></div></div>
<br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br></blockquote></div></div></div><br></div></div>
<br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br>
<br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div></div>