Sending Web Push to PWA/Safari iOS from java server

In this tutorial, you demonstrate subscribing for receive web push notifications in your desktop browser.

Have you been able to also get this working on a mobile PWA on iOS/Safari ? I have struggled to get this working. I do have it working with Android/Chrome. When I send the notification to a… endpoint, I’m getting the following response:

Response: statusline:HTTP/1.1 403 Forbidden
header:content-type=text/plain; charset=UTF-8
protocol version:HTTP/1.1
entity:[Content-Length: 24,Chunked: false]

This is bit out of Vaadin/Hilla subject as problem is in the web-push library, but seems that I found an answer.

At least I made safari to work with adding subject to PushService:
pushService = new PushService(publicKey, privateKey, "");

Cool. Thanks. I’ll give it a try.

Thank you soooo much, @kriss! That did it. Just adding a mailto as the subject was magic. Its amazing that APNs was returning a 403 Forbidden with no other help diagnosing the issue. Wow! Anyway, I really appreciate your help. I know this wasn’t a vaddin/hilla issue, but you helped out anyway. :slightly_smiling_face:

Glad that it work :smiling_face:
Another thing I suspected was: Encoding.AES128GCM, as by default “AESGCM” is used. As I was testing with:
Then I noticed there was a body in the response from PushService.send with “reason BadJwtToken” which helped me to find the gihub issue and then this solution.