XSF Discussion - 2018-12-17

  1. Holger

    Kev: A while back we were discussing silent APNS notifications, I think I promised to look up the docs on their unreliability. FWIW I now stumbled over them again: > APNs sends a limited number of silent notifications---notifications with the content-available key---per day. In addition, if the device has already exceeded its power budget for the day, silent notifications are not sent again until the power budget resets, which happens once a day. https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns

  2. Holger

    Also the description of the `apns-priority` field, and this: https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_updates_to_your_app_silently

  3. Holger

    (But either way Daniel's suggestion to use this would probably do the trick on recent iOS versions: <https://developer.apple.com/documentation/usernotifications/modifying_content_in_newly_delivered_notifications>)

  4. Ge0rG

    Holger: how does that relate to the proposal of sending stripped down stanzas to the push server (only XML meta-data)

  5. Holger

    Ge0rG: As you probably know, Chris' solution is to use high-prio notifications which don't wake the app but generate a lock-screen notification instead (and pressing that wakes the app). So he was interested in getting more info regarding the stanza that triggered the notification, in order to not generate lock screen notifications for stanzas without message body.

  6. Ge0rG

    Holger: I think that Anu is also working on content-modifications.

  7. Ge0rG

    Holger: yeah, but the high-prio vs. low prio thing somehow escalated

  8. Ge0rG

    and then it was buried for half a year and nobody remembers any more what the best solution was

  9. Holger

    With escalation you mean my stripped-down-stanza suggestion? :-) Chris' solution was/is basically to have the XMPP server distinguish between high/low prio, while I thought we might want to be more flexible in the future, i.e. for Jingle calls, MUC invitations, or whatever.

  10. Holger

    But if that content-modification thing does the trick, maybe we can forget about all that and get away with silent notifications after all. At least to get iOS working.

  11. Holger

    "Content modification" also allows omitting/removing the lock-screen notification altogether?

  12. Ge0rG

    Holger: I don't know about the last point

  13. Holger

    Ge0rG: BTW I don't quite understand the story with Monal. I thought it has that VoIP flag which would allow for silent high-prio notifications.

  14. Holger

    Apparently it either doesn't use those or they aren't reliable either. Not sure how the VoIP flag helps then.

  15. Ge0rG

    Holger: the latest Monal beta is working fine on yax.im, but apparently not on other servers.

  16. Ge0rG

    Holger: not sure which kind of notifications it's using

  17. Holger


  18. Ge0rG

    the whole thing is super complex, as other XEP implementations also play a role (CSI especially)

  19. Holger

    Yeah, I'm into *that* part of the complexity, but I'm clueless what happens once the notification reaches push.monal.im :-)

  20. Ge0rG just summoned the Monal developer. Hi Anu!

  21. Anu


  22. Anu

    What questions can I answer?

  23. Holger

    Anu: Hah, ignore my 1:1 messages then.

  24. Anu


  25. Ge0rG

    The first question was whether you can delete / merge newly-delivered-notification, to which the answer was "yes"

  26. Anu


  27. Ge0rG

    Anu: what kind of information do you need on the push server to determine whether to send a low-prio / high-prio / no push message?

  28. Anu

    Holger: Sorry I’m just waking up over here

  29. Holger

    Anu: There's no hurry :-)

  30. Holger

    Anu: A while back you said that the APNS notifications you're using won't (necessarily?) wake Monal if it was swiped away.

  31. Holger

    Anu: But doesn't Monal have this VoIP flag which would allow for silent high-prio notifications?

  32. Anu

    The push channel on monal at least just a signal and is silent (on or off) the actual logic happens entirely in xmpp. The push is not the notification, the notification is generated by the client manually not the server. This is why I can look at older messages and modify

  33. Holger


  34. Anu

    It only gets silent high priority notifications that resume/launch the app

  35. Ge0rG

    Anu: I thought you can't have silent *and* high-prio in the same notification

  36. Anu

    Swiping away will launch monal but in circumstances where the device is locked, it is not able to unlock the encrypted keychain

  37. Holger

    That's the idea of using 'silent' APNS notifications, right? I understand that they're usually throtteld by Apple. But I thought they're reliable for VoIP apps. Nevertheless they don't seem to be reliable for Monal?

  38. Holger


  39. Anu

    Monal is a special case blessed by Apple :)

  40. Ge0rG

    Anu: if Monal wasn't a VoIP blessed app, how would you work around that?

  41. Ge0rG

    We need XEP-0357 to also work for the non-VoIP use case

  42. Anu

    If it weren’t the then the notification could still be silent but notifications will fail when the app is closed and in those cases the notification text should be generated by the server in a second notification

  43. Anu

    So either the message body comes in the notification’s payload

  44. Ge0rG

    Anu: by the XMPP server or by the push server?

  45. Anu


  46. Anu

    But since the whole design is the push server shouldn’t see the text

  47. Ge0rG

    Anu: sending the message body over third-party channels is a security violation

  48. Anu


  49. Ge0rG

    so you'd have to send something like "You received a message"

  50. Ge0rG

    `push_notification_important_body = "Important message";`

  51. Anu

    So the xmpp server would need to see if the message was fetched after x amount of time

  52. Anu

    If not send a second non silent push message saying “you have a messag”

  53. Ge0rG

    Anu: shouldn't the push server figure that out?

  54. Ge0rG

    i.e. XMPP server sends a message skeleton to push.monal.im, the push service attempts a silent notification and if that fails re-attempts with a "loud" one, if there was an actual message

  55. Anu

    Push server is largely one way

  56. Ge0rG

    I'd rather not encode retry timing into the XMPP server

  57. Anu

    Failure does come on the apns feedback channel but that means the token is likely invalid

  58. Anu

    Apple is paranoid and rotates then

  59. Ge0rG

    Anu: so there is no feedback about whether the app actually was notified?

  60. Ge0rG

    Anu: it would be great to collect some numbers on how well silent vs. non-silent notifications work and what the delays are in practice

  61. Holger

    I think from user feedback it's obvious that silent notifications alone won't do the trick.

  62. Anu

    I don’t think so, they update it every year so I can take a look

  63. Anu

    Brb baby duties. Will be back in 30 min

  64. Holger

    As I said above I was hoping that this thing might do the trick (for iOS >= 10): https://developer.apple.com/documentation/usernotifications/modifying_content_in_newly_delivered_notifications

  65. Holger

    At least if it also allows for removing the lock-screen notification altogether.

  66. Anu

    Yeah an extension is just launching the app

  67. Anu

    Yeah an extension is just launching the app

  68. Anu

    The extension would be a new app

  69. Anu

    Sorry back

  70. Anu


  71. Anu

    Technically the extension is th opposite of monal but should work and have a similar effect.

  72. Anu

    I am adding logic for where it can’t download

  73. Anu

    The only issue is that like most of the world things are http focused.

  74. Anu

    In the case of xmpp, the extension would be a new app that opens a new connection (and resource)

  75. Anu

    I have a share extension and wen through some fun hoops to hide that

  76. Anu

    I’m very interested in more feedback on pushes on monal, I have never had any fail. If notifications don’t show up it’s usually the case that the push arrives but monal does not download a message

  77. Ge0rG

    Anu: or Monal can't resume the session for some reasons.

  78. Anu

    On jabb3r, yeah I’ve noticed this too but on yax it has

  79. Anu

    Thus the muc experience

  80. Ge0rG

    Anu: were you able to pinpoint why it fails?

  81. Anu

    No, the actual

  82. Anu

    Interaction is identical

  83. Anu

    It tries to resume and then receives an error

  84. Anu

    I thought it was monal too but the past week of testing muc with yax

  85. Anu

    It seems not to be the case

  86. Anu

    Now that I know it’s not client side, will good to actually debug on jabb3r now

  87. Anu

    Georg: as you know from your iOS device, notifications come in ( in excess) :)

  88. Ge0rG

    Anu: maybe Monal fails to resume within the 5 minutes timeout on jabb3r.org? I've got 30 minutes on yaxi

  89. Ge0rG

    Anu: maybe Monal fails to resume within the 5 minutes timeout on jabb3r.org? I've got 30 minutes on yax.im

  90. Anu

    With push the stream is supposed to never expire isn’t it?

  91. jonas’

    I don’t think that’s true

  92. jonas’

    that’s an implementation detail of some implementations (ejabberd)

  93. jonas’

    it gives you a certain time until after the first push to connect

  94. Anu


  95. Holger

    I *think* Prosody's mod_cloud_notify has a similar hack, but of course not all servers will have that enabled. (And either way there's still *some* timeout, just a longer one.)

  96. Anu

    Man push notifications are a pain

  97. Holger

    They are.

  98. Holger

    But why is the session thing so essential? I thought Monal supports MAM?

  99. Anu

    It’s really not that bad for other protocols

  100. Holger

    It's also not that bad on Android ;-) Because silent notifications 'just work'.

  101. Anu

    The diversity of configs and server software makes it really hard to deliver to consistent experience

  102. Anu

    Android isn’t really a privacy focused os though

  103. Anu

    So there’s a lot more wiggle room (and rope to hang with )

  104. Holger

    True. My point is just that I think the biggest pain here is the unreliable silent notifications.

  105. Holger


  106. Anu


  107. Anu

    I think the notifications are working

  108. Holger

    If resumption fails, won't you receive the message from MAM?

  109. Anu

    The issue is client side

  110. Anu


  111. Anu

    I don’t show notifications for mam messages

  112. Holger

    Ah, why not?

  113. Holger

    I would do that. You can't safely assume the message has been seen elsewhere just because you got it from MAM.

  114. Anu

    It was generating excessive notifications

  115. Holger

    So then you'd not have to worry about session timeouts, the experience will be the same either way. I think 0198 should just be seen as an optional optimization.

  116. Holger


  117. Anu

    Yeah if the resume fails it just connects like normal

  118. Anu

    Why I am puzzled by people not getting notifications

  119. Anu

    Apns is officially best effort

  120. Anu

    But in about 8 years or working with it I have never seen a notification fail to deliver

  121. Anu

    I’ve seen delays

  122. Anu

    But that’s usually cell network issue

  123. Holger

    I think the APNS throttling tries to be magic in that it depends on various factors such as the app usage, the battery, and whatnot?

  124. Holger

    So I guess it might be normal that experience differs?

  125. Holger

    With haven't tested Monal too much (my test iPad somehow doesn't like it) but with ChatSecure I had missing notifications all day long until Chris switched to high-prio notifications (which work reliably indeed).

  126. Holger


  127. Ge0rG

    Holger [14:30]: > If resumption fails, won't you receive the message from MAM? Except that failing resumption does the weirdest things to the messages in the SM queue.

  128. Holger

    Maybe, but that won't explain missing notifications/messages.

  129. Holger

    I mean, Monal not notifying on MAM messages would explain it I guess :-)

  130. Ge0rG

    The right thing is to de-duplicate between local history, MAM and offline messages, and to notify on *new* ones

  131. Ge0rG

    Except... you need to delay until you processed everything because you might have answered some of those from another device

  132. Ge0rG

    And this is where you need a Ph.D. to write a simple XMPP client.

  133. Holger

    The latter behavior would be nice to have (where 'answers' could include chat markers/whatever), but that's kinda optional I think.

  134. Holger

    I think for the moment it would be good enough to (1) deduplicate using the stanza ID (no Ph.D. required) and (2) notify on all messages (MAM or live).

  135. Holger

    Not sure how notifications on MAM messages generate a flood? Maybe a full query of a large MAM archive for the first time or something?

  136. Ge0rG

    Holger: (1) only works on private messages from clients that generate unique IDs; (2) ITYM "notify on *new* messages (MAM or live)"

  137. Ge0rG

    Holger: if you notify on each message, you'll end up flooded

  138. Holger

    I mean the server's stanza ID?

  139. Ge0rG

    Ah, so you mean the stanza ID and not the stanza ID. Yes.

  140. Holger

    Of course.

  141. Ge0rG

    Sorry for my misunderstanding.

  142. Holger

    I.e. depend on mam:2 for deduplication (unless you have a Ph.D. and too much time).

  143. Ge0rG

    So how do you deduplicate *sent* messages based on stanza ID?

  144. Holger

    Okay, (1) dedup incoming, (2) make your damn Ph.D., (3) dedup outgoing.

  145. Ge0rG

    Some days ago, I received multiple copies of the same message from an IRC transport, and the copies (routed to different of my resources, of which one was offline) had different message IDs.

  146. Ge0rG

    Also different stanza IDs

  147. Ge0rG

    There should be a XEP describing how to dedup

  148. Holger

    I'd use one of the other IDs for outgoing. But yes that's not nice.

  149. Anu

    A reminder that xmpp is a brutally complicated protocol. :)

  150. Anu

    Super powerful but often conflicting

  151. Ge0rG

    This is so sad.

  152. Zash

    Emergent complexity!

  153. Ge0rG


  154. Anu

    So on other protocols we’ve esp for mobile we’ve ditched the idea of being offline. Things are down based on devices registered

  155. Anu

    Deduping on a guid associated with every message

  156. Ge0rG

    Anu: yeah, that's a great approach but XMPP isn't there yet

  157. Anu

    I just discovered how to query mam archives in reverse chronological order

  158. Anu

    Thanks Georg

  159. Anu

    That will probably help too

  160. Ge0rG

    Anu: I'm not sure it's a good idea to query them in reverse

  161. Anu


  162. Ge0rG

    Anu: some messages contain back-references, like LMC

  163. Anu

    You want to see newest first and the pull the older ones later

  164. Anu


  165. Ge0rG

    Anu: so now you need to cache the newer message that references an old one until the old one has arrived. https://xmpp.org/extensions/xep-0308.html Last Message Correction

  166. Anu

    Oh fun

  167. Anu

    The problem with my current mam

  168. Ge0rG

    Anu: okay, pulling in the last 50 in linear order won't save you from that

  169. Anu

    Is 90 percent of hemtime I use my phone

  170. Anu

    When I go to my iPad or laptop it starters to get every message since I last used it

  171. Holger

    Ge0rG: It's not mandatory to support LMC though.

  172. Ge0rG

    Holger: nothing is mandatory. What's your point?

  173. Ge0rG

    BTW, LMC would be a good addition to cs-2019, cc jonas’

  174. Anu

    And what I really care about is most recent, I can pull down to get more if I need more

  175. Holger

    Ge0rG: My point is I would not let my MAM retrieval strategy depend on XEP-0308.

  176. Holger

    If the original message isn't within the chunk I got from MAM, so be it. If the user scrolls up, he'll receive it. Probably. The server might've ditched it already anyway.

  177. Ge0rG

    Anu: then you need to mark a message with an LMC for something that you haven't fetched yet and merge them when the user pulls down

  178. Anu


  179. Ge0rG

    LMC is just one example of message references.

  180. Anu

    Basically some tie breaker logic

  181. Holger

    And my point would probably remain the same for any other examples.

  182. Holger

    There's no guarantee you get the original message anyway.

  183. Ge0rG

    No guarantee, no.

  184. Holger

    So don't make XMPP life even complicater than it is anyway.

  185. Anu

    Yeah it’s based on age and archiving preferences

  186. Ge0rG

    said the server developer.

  187. Anu

    Holger: quick question, monal works on the iPad 2 up

  188. Anu

    Basically every iPad but the original

  189. Anu

    What do you have? It should work for you

  190. Holger

    Anu: I can no longer reproduce the crashes. It seemed like it was triggered by some MAM message which is no longer retrieved (not sure why, I'll have to look).

  191. Anu

    There were a few ui glitches recently but I’ve been fixing those

  192. Anu

    Also I’ve fixed a lot of crashes

  193. Holger

    Ah yes I did update recently, maybe it was due to your fixes.

  194. Anu

    I fix them as soon as they come in to crashlytics and put our an update the same day

  195. Anu

    When I am working on it there is a release nightly for betas and weekly for prod

  196. Holger

    Very cool.

  197. Holger

    I'll have to look into the MAM thing but other than that I'm happy :-) Unfortunately I can also reproduce missing push notifications though---even with normal live messages.

  198. Anu

    2 week sprints, crashlytics is my feedback loop

  199. Anu

    Any particular server?

  200. Holger

    Now that it's no longer crashing, I'll be much better with looking at the traffic and things.

  201. Holger

    I'm using conversations.im for testing.

  202. Anu

    I realize all the servers I’ve tested with have been prosody, made a balbber.im account to test with ejabberd

  203. Anu

    On the betas there is a log at the bottom of settings, it’s the devices console

  204. Anu

    So it prints out the full stream and all errors there

  205. Anu

    New release coming out today btw

  206. Holger

    Right now I'm using the release, I'd be happy to switch to the betas.

  207. Anu

    I added muting becuae the notifications are a little too good esp with muc

  208. Holger


  209. Anu

    Switch to the betas on my website

  210. Anu

    Better if you are a developer

  211. Ge0rG

    Anu: I suggest two things: - collect all new messages per JID/MUC until sync is completed - don't make notifications if you see recent activity from another device

  212. Anu


  213. Anu


  214. Anu

    Might be the right approach

  215. Holger

    Anu: Installed, thanks.

  216. Anu

    If messsges fail to arrive take a look at the log, it’s pretty raw but you can see every stanza sent and receives

  217. Anu

    If you see anything wrong let me know I can usually have a fix up in a few hours

  218. Holger

    Yes that's very useful.

  219. Holger

    Awesome to see you being so active.

  220. Anu

    The more feedback the better, I can’t really test everything myself so it’s great when others let me know when they see bugs :)

  221. Ge0rG

    Anu: did you implement LMC already? :D

  222. Anu

    Not in develop branch yet

  223. Anu


  224. Anu

    It will be there soon though, I have a lot of feyures that I am sitting on becuase I need to put our bug fixes

  225. Anu

    And I generally dont do major features and bug fixes in the same releases

  226. jonas’

    Ge0rG, re LMC + CS-2019: PR please?

  227. Ge0rG

    jonas’: last time you asked for ML and not for PR :>

  228. jonas’

    I don’t care, I take either

  229. Ge0rG

    jonas’: any chance to demote Avatars from Core to Advanced? :D

  230. jonas’

    hm, not sure

  231. Zash

    Mmmmmm, does Avatars depend on PEP+ / 222?

  232. Ge0rG

    So now that Logitech is discontinuing XMPP support on their Harmony smart remote control, I first time hear about that support: https://twitter.com/smkelly/status/1074494850815455232

  233. Ge0rG

    XMPP Marketing at its best

  234. Anu

    Funny I know a lot of iot devices use xmpp

  235. Anu

    Robot vacuums for example

  236. Ge0rG

    It'd be great to fill the IoT page under https://xmpp.org/uses/ with specific examples, akin to Online Games; instead of a generic definition of what IoT is about

  237. Zash


  238. Ge0rG

    I'm sure we've had that discussion before, and I'm sure I wrote an issue for it already, but I can't find it.

  239. Ge0rG

    Zash, Anu: https://github.com/xsf/xmpp.org/issues/490

  240. moparisthebest

    Guy on curl mailing list is asking for advice about how to implement 'push notifications' with curl as the client

  241. moparisthebest

    Someone mentioned you could make a request and wait for server to respond, guy asked "but what if the server has something to send and the client has lost connection"

  242. Ge0rG

    curl does xmpp now?

  243. moparisthebest

    Inb4 re implementing xmpp poorly on top of http

  244. moparisthebest

    No but I'm thinking of suggesting he use xmpp instead of http

  245. Zash


  246. Ge0rG

    isn't that the company that provided emission manipulation devices to Volkswagen?

  247. Ge0rG

    Anu: could you add your vacuums to the issue?