Registering and unregistering from Simple Push and Unified Push

classic Classic list List threaded Threaded
7 messages Options
mo
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Registering and unregistering from Simple Push and Unified Push

mo
Hi,

We use OpenShift AeroGear Push Server Cartridge.

I've decided to register with simple-push and unified-push every time the user logs into our application.  Also to unregister from both unified-push and simple-push when they log out or browser closes.  Is this a good idea or bad idea?

Also, I've always wondered about the following comment in a sample code:

"if it is the first registration, need to register the 'pushEndpoint' with the UnifiedPush server."

Can somebody explain what is meant by the comment?  For example, what would count as a registration that's not the first?

Thank you.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] Registering and unregistering from Simple Push and Unified Push

Sebastien Blanc
Hi,

On Tue, Jun 30, 2015 at 7:30 PM, mo <[hidden email]> wrote:
Hi,

We use  OpenShift AeroGear Push Server Cartridge
<https://github.com/aerogear/openshift-origin-cartridge-aerogear-push>  .

I've decided to register with simple-push and unified-push every time the
user logs into our application.  Also to unregister from both unified-push
and simple-push when they log out or browser closes.  Is this a good idea or
bad idea?
Any reasons you are doing it this way ? AeroGear's SPS  JS implementation will keep a mapping SPS <-> UPS in your localStorage, so when you register again it will use this instead of creating a new installation.
By registering/unregistering each time you will "pollute" the installation table in UPS.


Also, I've always wondered about the following comment in a sample code:

"if it is the first registration, need to register the 'pushEndpoint' with
the UnifiedPush server."
<https://github.com/aerogear/aerogear-js-cookbook/blob/master/simplepush-unifiedpush-example/js/unifiedpush.js#L27-L28>
Once a SPS endpoint has been received it needs to register with the UPS except when it has already be done (see previous comment) 

Can somebody explain what is meant by the comment?  For example, what would
count as a registration that's not the first?

Thank you.



--
View this message in context: http://aerogear-users.1116366.n5.nabble.com/Registering-and-unregistering-from-Simple-Push-and-Unified-Push-tp86.html
Sent from the aerogear-users mailing list archive at Nabble.com.
_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users


_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] Registering and unregistering from Simple Push and Unified Push

Matthias Wessendorf
Hi Mo,

one note, we recently removed SimplePush from our Openshift Push cartridge, but more inline

On Wed, Jul 1, 2015 at 9:31 AM, Sebastien Blanc <[hidden email]> wrote:
Hi,

On Tue, Jun 30, 2015 at 7:30 PM, mo <[hidden email]> wrote:
Hi,

We use  OpenShift AeroGear Push Server Cartridge
<https://github.com/aerogear/openshift-origin-cartridge-aerogear-push>  .

I've decided to register with simple-push and unified-push every time the
user logs into our application.  Also to unregister from both unified-push
and simple-push when they log out or browser closes.  Is this a good idea or
bad idea?
Any reasons you are doing it this way ? AeroGear's SPS  JS implementation will keep a mapping SPS <-> UPS in your localStorage, so when you register again it will use this instead of creating a new installation.

Sebi, Is that really the case? is it really stored? and a reconnect works?

One big issue w/ SimplePush is, there is no notion of getting an ACK about if the channel is gone or not.
Our server returns 200 for each PUT:

However, I recently noticed, that (regardless of the SimplePush Spec), the deployed MOZ server (wss://push.services.mozilla.com)  has a different notion:
200 -> OK (channel is active/registered/online)
202 -> Accept (chanel is known, but not yet online - scheduled for later delivery)
401/405 -> "errors" IMO sent when the PUT URL is invalid

I think perhaps we need to revisit this in our Server impl.


By registering/unregistering each time you will "pollute" the installation table in UPS.

unregister will enure bogus installations (w/ eventually outdated channels) are no longer in the DB.

simplepush is a bit different here - yes :-)
 


Also, I've always wondered about the following comment in a sample code:

"if it is the first registration, need to register the 'pushEndpoint' with
the UnifiedPush server."
<https://github.com/aerogear/aerogear-js-cookbook/blob/master/simplepush-unifiedpush-example/js/unifiedpush.js#L27-L28>
Once a SPS endpoint has been received it needs to register with the UPS except when it has already be done (see previous comment) 

Can somebody explain what is meant by the comment?  For example, what would
count as a registration that's not the first?

Thank you.



--
View this message in context: http://aerogear-users.1116366.n5.nabble.com/Registering-and-unregistering-from-Simple-Push-and-Unified-Push-tp86.html
Sent from the aerogear-users mailing list archive at Nabble.com.
_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users


_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users




--

_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] Registering and unregistering from Simple Push and Unified Push

Sebastien Blanc


On Wed, Jul 1, 2015 at 10:23 AM, Matthias Wessendorf <[hidden email]> wrote:
Hi Mo,

one note, we recently removed SimplePush from our Openshift Push cartridge, but more inline

On Wed, Jul 1, 2015 at 9:31 AM, Sebastien Blanc <[hidden email]> wrote:
Hi,

On Tue, Jun 30, 2015 at 7:30 PM, mo <[hidden email]> wrote:
Hi,

We use  OpenShift AeroGear Push Server Cartridge
<https://github.com/aerogear/openshift-origin-cartridge-aerogear-push>  .

I've decided to register with simple-push and unified-push every time the
user logs into our application.  Also to unregister from both unified-push
and simple-push when they log out or browser closes.  Is this a good idea or
bad idea?
Any reasons you are doing it this way ? AeroGear's SPS  JS implementation will keep a mapping SPS <-> UPS in your localStorage, so when you register again it will use this instead of creating a new installation.

Sebi, Is that really the case? is it really stored? and a reconnect works?
Yes and it should reconnect but tbh long time ago I tested that 
  

One big issue w/ SimplePush is, there is no notion of getting an ACK about if the channel is gone or not.
Our server returns 200 for each PUT:

However, I recently noticed, that (regardless of the SimplePush Spec), the deployed MOZ server (wss://push.services.mozilla.com)  has a different notion:
200 -> OK (channel is active/registered/online)
202 -> Accept (chanel is known, but not yet online - scheduled for later delivery)
401/405 -> "errors" IMO sent when the PUT URL is invalid

I think perhaps we need to revisit this in our Server impl.


By registering/unregistering each time you will "pollute" the installation table in UPS.

unregister will enure bogus installations (w/ eventually outdated channels) are no longer in the DB.

simplepush is a bit different here - yes :-)
 


Also, I've always wondered about the following comment in a sample code:

"if it is the first registration, need to register the 'pushEndpoint' with
the UnifiedPush server."
<https://github.com/aerogear/aerogear-js-cookbook/blob/master/simplepush-unifiedpush-example/js/unifiedpush.js#L27-L28>
Once a SPS endpoint has been received it needs to register with the UPS except when it has already be done (see previous comment) 

Can somebody explain what is meant by the comment?  For example, what would
count as a registration that's not the first?

Thank you.



--
View this message in context: http://aerogear-users.1116366.n5.nabble.com/Registering-and-unregistering-from-Simple-Push-and-Unified-Push-tp86.html
Sent from the aerogear-users mailing list archive at Nabble.com.
_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users


_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users




--

_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users



_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
mo
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] Registering and unregistering from Simple Push and Unified Push

mo
In reply to this post by Sebastien Blanc
Hi Sebastien,

If the contents of the localStorage were deleted for one reason or another, then I believe the browser would have to register anew with SPS and UPS next time.  In that case the original registration would be a "bogus installation" on USP as Matthias puts it, I'm thinking.  Am I correct?  I don't know whether there's going to be any stale data on the side of SPS.  Is there?

Also, how should I detect whether registration with SPS is previously done?  Would the `mailEndpoint` be falsey in that case?  I'm talking about this sample code.  

Here's another, related question.  When we reuse registrations in the way you describe, is there any reason ever to call `navigator.push.unregister(...)` or `unifiedPushClient.unregisterWithPushServer(...)`???  I have not seen a sample code where `navigator.push.unregister(...)` was used.  I believe I've seen `unregisterWithPushServer(...)` somewhere.  Note, I don't exactly know what these unregister functions do.

Thank you.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] Registering and unregistering from Simple Push and Unified Push

Sebastien Blanc
Hey,
sorry for the late response

On Wed, Jul 1, 2015 at 10:06 PM, mo <[hidden email]> wrote:
Hi Sebastien,

If the contents of the localStorage were deleted for one reason or another,
then I believe the browser would have to register anew with SPS and UPS next
time.  In that case the original registration would be a "bogus
installation" on USP as Matthias puts it, I'm thinking.  Am I correct?
Yes 
  I
don't know whether there's going to be any stale data on the side of SPS.
Is there?
I think SPS has some kind of "reaper" service that does a clean up but to be honest I don't know the details of it. Daniel (who is currently on parental leave) could give you more details on that/ 

Also, how should I detect whether registration with SPS is previously done?
Would the `mailEndpoint` be falsey in that case? 
Yes 
I'm talking about  this
sample code
<https://github.com/aerogear/aerogear-js-cookbook/blob/master/simplepush-unifiedpush-example/js/unifiedpush.js#L29>
.

Here's another, related question.  When we reuse registrations in the way
you describe, is there any reason ever to call
`navigator.push.unregister(...)` or
`unifiedPushClient.unregisterWithPushServer(...)`???  I have not seen a
sample code where `navigator.push.unregister(...)` was used.  I believe I've
seen `unregisterWithPushServer(...)` somewhere.  Note, I don't exactly know
what these unregister functions do.
This could be used when an user don't want to receive notification anymore, imagine a config section in the webapp where the user can turn off the notification for instance.
 

Thank you.





--
View this message in context: http://aerogear-users.1116366.n5.nabble.com/Registering-and-unregistering-from-Simple-Push-and-Unified-Push-tp86p95.html
Sent from the aerogear-users mailing list archive at Nabble.com.
_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users


_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
mo
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] Registering and unregistering from Simple Push and Unified Push

mo
Hi Sébastien,

Sébastien Blanc wrote
>
> Also, how should I detect whether registration with SPS is previously done?
> Would the `mailEndpoint` be falsey in that case?

Yes

> I'm talking about  this
> sample code
> <
> https://github.com/aerogear/aerogear-js-cookbook/blob/master/simplepush-unifiedpush-example/js/unifiedpush.js#L29
> >
> .
I haven't run the sample code I mention above.  But in my code the endpoint (`event.target.result`) is never falsey.  I just tested this.  I use aerogear.js version 2.0.0.  My code snippet below:

```javascript
    request.onsuccess = function (event) {
      var endpoint = event.target.result;
      var channelID = event.type.replace('-success', '');

      if (! endpoint) {
        console.log('null endpoint for topic registration: channelID=' + channelID);
        return;
      }

      console.log('successful simple push registration: topic=' + topic + ', channelID=' + channelID);
```
Console always logs 'successful simple push registration'.

Also Matthias, if I am supposed to register with simple push only the first time, then should I still be registering/unregistering with UPS every time I run my application?
Loading...