Do we have any documentation or demo or blog article, how can we integrate push notification with PWA/WebApp in TMS Web Core?
I'm thinking about standard services for this, e.g. FireBase etc.
this is very important since safari supports push notification for web app (IOS 16.4)
Yes I saw this demo but I see that it uses internal push server without source code.
Where can I find info how use this component to FireBase or other known push notification cloud services?
At this moment we do not have such sample applications with other push notification services. We just did work on handling this with a custom built push notification server.
We've added it on the feature request list to consider building a demo showing integration with other push notification services.
Bruno, what is this "custom built push notification server" based on? - I could find no samples and no info. The TWebPushNotifications demo tries to connect to http://localhost:8001/registerSubscription, but there's no matching server sample I could find that provides this service. Also, the Vapid parts should be described some more as well.
Just trying to set up a simple server/client push POC to see how it all hangs together, with the ultimate goal to create a 2FA PWA client app. I would also be interested to know more if there's a way for the WebCore app with a TWebPushNotifications to also use any kind of biometric user identification in the process.
We built it internally here and this push notification server is included under demos Demo\Basics\PushNotifications
At this moment, this demo push notification server is the result of internal development. We are working on also providing tooling in the near future so you can build your own custom push notification servers.
Would it allow TWebPushNotifications to intercept notifications in a PWA app, to provide a means to do 2FA? I.e.: the way MS Authenticator does it for Azure?
This is one of my blog posts that I have to refer to myself as it isn't information that I use often enough to retain. Maybe something is of interest to you?
Not sure what do you mean by intercepting notifications to provide 2FA? Maybe there is some confusion around what push notifications are and how they work?
Web push notifications are nothing more than push notifications sent to the device. That is a popup notification on your device with a title (and optionally body, icon, etc) - think about all the websites that ask you to receive them and what many native app sends you.
The 3 basic parts are:
TWebPushNotification: Subscribes to the push service of the browser
service worker file: shows the notification on the push event
Server/sender: sends the notification to the subscription that was received by TWebPushNotiifcation
If you want to generate a one time password (OTP) on your server and send that to your users as a push message, it could work. But you'll need to consider that push notifications might arrive minutes later, at which point the OTP could already be expired.
Yes, thanks, OTP is the goal. And a code can be sent, apparently, whether the App is running or not, as far as I can tell. The delay you mentioned is a surprise - why is that and can it be in any way controlled?
What I meant is, given that the App is running at the time, when such notification comes through, would the App see it (i.e.: in Delphi code, can I have an Event Handler)?
In this respect, I may be looking at a wrong technology. Maybe I should be looking at webhooks? I haven't done anything of this kind before, looking for something simple and reliable to be used, to send "notifications" to an PWA Apps - not just codes, ideally it would be a request to authenticate with a fingerprint or a face scan, which I'll need to figure out how to do in a PWA next ;-)
Not really. There are a lot of materials out there where you can learn more about how web push works exactly. To keep it short and oversimplified:
From the browser's side there's the push service (who provides the subscription object). Once you send your push messages to the service via the subscription object, all the responsibility will be on the service. It needs to forward the message to the device. The device needs to have the background service running that is listening for push notifications from the push service itself, so it can forward the incoming message to the application that needs it. After that happens, the service worker push event will trigger.
Most of the time this whole flow is immediate, but in our tests we've seen that push messages can sometimes take a significant delay to arrive.
When using Chrome/Firefox the service can be inactive while the device is sleeping to improve battery consumption - although this should be less of an issue as long as the device is active.
In Safari however it's not clear why a delay happens. We checked all the settings that were advised but even then they tend to arrive after minutes - as if the background service that is responsible for receiving the push messages is not awake. Once the first notification comes through, the rest is immediate for a while before having a delay again.
Webhooks are usually for server side. Perhaps web sockets or server sent events are something you could use to get messages to the client form your server without delays.