<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 25, 2015 at 1:30 PM, Rob Willett <span dir="ltr">&lt;<a href="mailto:rob.aerogear@robertwillett.com" target="_blank">rob.aerogear@robertwillett.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>
<p dir="auto">Erik,</p>

<p dir="auto">Thanks for the thoughtful reply. </p>

<p dir="auto">Great minds think alike :)</p>

<p dir="auto">We have already worked through this as an option and it is probably the likeliest way forward for us. Indeed your notes and ours are almost identical. </p>

<p dir="auto">You (or Corrine) have correctly identified the pitfalls regarding background and foreground. There is one other case and thats when the app is not actually started up. We still want to send them notifications (at least for a while) alerting them to traffic issues. After a day or so, we’ll throttle back these notifications but at least for a few hours or a day, we need to send them out. We can’t use the content-available flag as the app isn’t running (in either bg or fg) to handle the flag. So we have to try to work out if the app is ‘alive’ or not, if the app is not alive we send down full-fat notifications, this means no content-available flag and full information to be displayed in the notification drawer. </p>

<p dir="auto">Our potential solution has us send out a single silent notification to everybody who needs to be sent one. The device segmentation to determine who gets information is already done by us. The payload for the silent notification is actually empty and its used as a signalling mechanism. This tells the app when it is in the fg or bg to phone home and get a specific payload for that user. When the app contacts the backend database to retrieve the payload, we flag the app as alive and working.</p></div></blockquote><div><br></div><div>when in background, on iOS you have a 30 second time window to fetch data from the backend. I&#39;d use that to issue local notification, these are usually better to handle user interactions.</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><p dir="auto"> </p>

<p dir="auto">If we send out a silent notification but never get a response to get a payload, then we flag the app as not started. After every batch of silent notifications are sent, 60 secs later, we then do a second cycle looking at whether the devices have NOT responded. If the app has not responded then we move to full notifications for that device and don’t use content-available. Once the user clicks on a notification and starts the app up, we can see that and we move them into the ‘alive’ state, so next time we send silent notifications.</p></div></blockquote><div><br></div><div>that&#39;s nice trick, I&#39;d like that &quot;engine&quot; on the UPS :-) haha</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><p dir="auto"> </p>

<p dir="auto">The process diagram is a lot simpler than my explanation :) </p>

<p dir="auto">The other reason for sending a single silent notification with little information in and to get the app to respond to that single notification is quite subtle and appears on the surface to be counter intuitive. We <em>could</em> send down batches of notifications and so each device could receive 3-4 notifications. This would mean that since we cannot predict the order of the notifications or even if they arrive, we would have to constantly be sending data back to our server telling us that the app is alive. We would have 2-3 times the number of connections coming back in which need to be processed very quickly. Our system is quite bursty, nothing happens for 3-4 minutes and then all hell breaks lose as we have to manage everything in around 30 secs. Also we are relying on every notification getting through we would be sending a lot of data which you have correctly identified as potentially an issue as well.</p></div></blockquote><div><br></div><div>what are you doing when push notifications are disabled?</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><p dir="auto"> </p>

<p dir="auto">We also looked at sending our highly specific payloads, i.e. each user getting one message but that one message has 3-4 notifications in it. This would mean we have to process, generate and send thousands of individual messages. We know we can generate the individual messages quite quickly, but the the network connection costs are too high (so we believe). Simply connecting to the servers, opening the connection, sending and tearing the connection down could take a long time (minutes?) for 5,000 users. We don’t want to spread the connection time out, we want the data to get to the user ASAP.</p></div></blockquote><div>yeah, I&#39;d think so too, that sending a bunch of msgs might take sometime of HTTP traffic. Regarding getting info out ASAP, for apps that are alive (in fg), have you thought about using a TCP socket? I found this article interesting <a href="http://blog.layer.com/how-we-leverage-ios-push-notifications/">http://blog.layer.com/how-we-leverage-ios-push-notifications/</a> - worth a read.</div><div><br></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><p dir="auto"> </p>

<p dir="auto">If your views are different on the time take not do this, I’d be interested in hearing them as we believe the connection time would be too long. Since we don’t have 5,000 users we can’t easily test our hypothesis. </p>

<p dir="auto">Rob</p><div><div class="h5">

<p dir="auto">On 25 Nov 2015, at 10:50, Erik Jan de Wit wrote:</p>

</div></div><blockquote><div><div class="h5">
<p dir="auto">Hi Rob,</p>

<p dir="auto">Like Matthias already told you on Android managing notifications and<br>
changing how they look is much simpler then on iOS. On iOS you can cancel<br>
all the remote notifications, but not some.</p>

<p dir="auto">Corrine had this idea: send your notifications as &#39;background<br>
notifications&#39; (e.g. &#39;content-available&#39; flag set) then your app will be<br>
notified, but nothing will show up in the Notification area. You can use<br>
local notifications to create the notification in the notification area,<br>
because these you can cancel. You decide how they show up and even group<br>
them. The cordova plugin to create local notifications is called<br>
&#39;cordova-plugin-local-notifications&#39; [1]</p>

<p dir="auto">So you will have to deal with the complexities of background notifications<br>
for this to work, but to determine if the app is in the foreground when the<br>
background notification arrives there is a boolean on the notification to<br>
help [2]</p>

<p dir="auto">Although I must advise you sending large volumes of messages might not be a<br>
great way to use push notifications, it&#39;s meant to inform the user that<br>
something important has happened it should be personal and engage the<br>
users. Users could also opt to turn off the push notifications so you can&#39;t<br>
use it to transfer data.</p>

<p dir="auto">Hope this helps</p>

<p dir="auto">[1] <a href="https://github.com/katzer/cordova-plugin-local-notifications" target="_blank">https://github.com/katzer/cordova-plugin-local-notifications</a><br>
[2]<br>
<a href="https://aerogear.org/docs/guides/aerogear-cordova/AerogearCordovaPush/#_ios_background_notification" target="_blank">https://aerogear.org/docs/guides/aerogear-cordova/AerogearCordovaPush/#_ios_background_notification</a></p>

<p dir="auto">On Wed, Nov 25, 2015 at 11:07 AM, Matthias Wessendorf <a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a><br>
wrote:</p>

</div></div><blockquote><div><div class="h5">
<p dir="auto">On Wed, Nov 25, 2015 at 10:14 AM, Rob Willett &lt;<br>
<a href="mailto:rob.aerogear@robertwillett.com" target="_blank">rob.aerogear@robertwillett.com</a>&gt; wrote:</p>

<blockquote>
<p dir="auto">Hi,</p>

<p dir="auto">We’ve got the Unified Push Server working on the OpenShift platform.<br>
No real issues once we’d understood the point of aliases.</p>

<p dir="auto">We can send notifications quite happily and see whats going on. We use<br>
Perl for our backend servers and so we wrote a small Perl interface. If<br>
anybody wants the code for the Perl interface let me know and we’ll<br>
pass it on. We can’t claim a lot of credit for a simple piece of code<br>
:)</p>
</blockquote>

<p dir="auto">sure, I think that would be awesome, if you could publish it on github.<br>
We will promote if for other perl users!</p>

<blockquote>
<p dir="auto">Anyway, one of edge use-cases would be to delete notification or set of<br>
notifications when the app is running but in the background on iOS.</p>

<p dir="auto">We want to do this as the user can receive a high number of<br>
notifications (&gt; 10) when the app is in the background. Notifications<br>
come in groups and provide traffic updates, so a user may get a new<br>
group of 3-4 traffic updates, this new group completely supersedes ANY<br>
previous update. Our data is valuable when fresh and useless when over<br>
10 minutes old.</p>

<p dir="auto">Whilst we can simply ignore old notifications, UX testing has shown the<br>
users don’t like having old notifications sitting round. We know that<br>
the users can delete them individually or delete the lot from the<br>
notification drawer OR can simply bring the app out of the background<br>
BUT they don’t like doing that.</p>

<p dir="auto">So what we want to do is delete old notifications, we were hoping for<br>
the ability to call a JavaScript function with say a parameter to<br>
identify notifications by a group or something, but we could accept<br>
deleting the lot and inserting local notifications instead.</p>

<p dir="auto">We know that we can send content-available and have stuff pulled from a<br>
server in the background. This option is quite difficult for us and has<br>
some complexity identifying when the app is not started up. The simplest<br>
option is delete some or all of the notifications.</p>

<p dir="auto">Does anybody know if this is possible or any other suggestions?</p>
</blockquote>

<p dir="auto">I think that&#39;s an interesting idea. Erik Jan recently did an update for<br>
message, on Cordova, to actually stack em:<br>
<a href="https://github.com/aerogear/aerogear-cordova-push/pull/81" target="_blank">https://github.com/aerogear/aerogear-cordova-push/pull/81</a></p>

<p dir="auto">Perhaps we could have a &#39;delete&#39; feature too. Mind filing a JIRA against:<br>
<a href="https://issues.jboss.org/projects/AGCORDOVA" target="_blank">https://issues.jboss.org/projects/AGCORDOVA</a><br>
(you need to have an account in order create tickets)</p>

<p dir="auto">Cheers!<br>
Matthias</p>

</div></div><blockquote>
<p dir="auto">Thanks</p>

<p dir="auto">Rob</p>

<hr>

<p dir="auto">Aerogear-users mailing list<br>
<a href="mailto:Aerogear-users@lists.jboss.org" target="_blank">Aerogear-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-users" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-users</a></p>
</blockquote><span class="">

<p dir="auto">--<br>
Matthias Wessendorf</p>

<p dir="auto">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></p>

<hr>

</span><p dir="auto">Aerogear-users mailing list<br>
<a href="mailto:Aerogear-users@lists.jboss.org" target="_blank">Aerogear-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-users" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-users</a></p><span class=""><font color="#888888">
</font></span></blockquote><span class=""><font color="#888888">

<p dir="auto">-- <br>
Cheers,<br>
    Erik Jan</p>

<hr></font></span><span class="">

<p dir="auto">Aerogear-users mailing list<br>
<a href="mailto:Aerogear-users@lists.jboss.org" target="_blank">Aerogear-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-users" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-users</a></p>
</span></blockquote>

</div><br>_______________________________________________<br>
Aerogear-users mailing list<br>
<a href="mailto:Aerogear-users@lists.jboss.org">Aerogear-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-users" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">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>