Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #40927

Re: webpush duplicate notifications

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Jan Bruns <ebay@abnuto.de>
Newsgroups comp.lang.javascript
Subject Re: webpush duplicate notifications
Date 26 Jun 2022 02:42:04 GMT
Lines 81
Message-ID <jhpvbsFd85oU1@mid.individual.net> (permalink)
References <jhig9bF9s16U1@mid.individual.net>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Trace individual.net lEyJ2tp+aIfxw4qOc//qXQM38fPeSplzH6/ZZyFImOWWAFHgQn
Cancel-Lock sha1:EABsiWzCjamy1Ma3oh/HmXtvBbc=
User-Agent Pan/0.145 (Duplicitous mercenary valetism; d7e168a git.gnome.org/pan2)
Xref csiph.com comp.lang.javascript:40927

Show key headers only | View raw


To clarify the question and/or ease up a similar experiment for others...


A website/client registers web-push for my domain (by calling 
pushManager.subscribe()), and sends the relevant subscription data to my 
Notification source server.


On that server, to send a notification, I run the command  
   

curl -v -X POST -H "Authorization: Bearer $jwt" -H "Crypto-Key: 
p256ecdsa=$pubkey" -H "TTL:0" $link


where $pubkey is the same as the one that was passed to 
pushManager.subscribe(), $link is the endpoint as returned by that call, 
and $jwt is some infoblock signed using the private key corresponding to 
$pubkey.


A Desktop FireFox behaves exactly as expected: If it is running, it 
displays the Notification (no matter if the specific site is running). 
Also if it isn't running, but is coming up within the specified TTL.


For Desktop Chromium, the behaviour is similar, but if the browser window 
isn't maximized and doesn't show a tab with the site, it geneates an 
addional Notification about backgound activity (that I don't intend to 
generate!).


https://jan.abnuto.de/pushtest/Screenshot_desktop.png


With android chromium, the behaviour is similar to desktop chromium, but 
a little relaxed in terms of "browser is running" as well as "tab showing 
site", but the issue remains the same: 



https://jan.abnuto.de/pushtest/Screenshot_20220626-031943_Chrome.jpg


How to prevent this additional Notification?


My guess is that it is shown because of the fetch (to give the user some 
impression about tracking?). But I think it can also be closed (even 
though I haven't yet functional code that doesn't break cross-brwoser 
compatibility).


Does it maybe have a specific tag, so that it can be updated by the real 
notification?


Maybe some non-standard info I could include into the $jwt? (it's 
currently only: sub,aud,exp).


Gruss


Jan Bruns


PS: this service worker was used here: 
https://jan.abnuto.de/pushtest/sw2.js

and, finally, here's a perl-script that can be used to generate the jwt, 
to be called like:


$(perl perl.pl "https://host-from-endpoint" "mailto:admin@notify-sender" 
seconds-jwt-valid)


https://jan.abnuto.de/pushtest/perl.pl

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

webpush duplicate notifications Jan Bruns <ebay@abnuto.de> - 2022-06-23 06:41 +0000
  Re: webpush duplicate notifications Jan Bruns <ebay@abnuto.de> - 2022-06-26 02:42 +0000
    Re: webpush duplicate notifications Jan Bruns <ebay@abnuto.de> - 2022-06-26 05:01 +0000
      Re: webpush duplicate notifications Jan Bruns <ebay@abnuto.de> - 2022-06-27 08:50 +0000
  Re: webpush duplicate notifications Härra Rabmo <ingel1983912@gmail.com> - 2022-07-06 09:13 -0700
  Re: webpush duplicate notifications "He, who travels time to time" <he1983912@aol.com> - 2022-09-22 07:24 -0700

csiph-web