What I'm trying to do is make a web app that has a Service Worker installed to show push notifications to the user using Push Notifications API on Chrome and Firefox.
But I don't know if this can be done when user session expires, because server side sessions are closed after three hours. ¿It is possible that service worker continues to show notifications based on a cached user maybe, or it requires that the user is being logged in. I know it may not be very good to normal end users, but this is an internal system so it doesn't matter if they keep getting notifications all day.
Using Service Workers and the Push API, you can send and show notifications whenever you want. There isn't the concept of log in, you can send a notification to any user that accepts to be notified (N.B.: the browser prompts the user for permission).
To clarify your understanding, you could take a look at the demo here: https://serviceworke.rs/push-simple.html
Related
I have a working PWA application and i have tried integrating push notifications to it which worked. But those notifications happened totally in the front end, a user has to click a button and a push notifications would show up.
In my application i have a cronjob that runs every night to check if certain things are updated. If so i want to send a push notification to a user to notify them.
But i cannot find any information regarding this subject so I'm thinking it's not possible since the nodejs server doesn't have a connection to the PWA. Is there something I'm overlooking on my approach or is it simply not possible?
I know there are methods to check both iOS and Android to see if the user has locally disabled push notifications for an app, that is done within the app itself. But if a user disables push notifications for an app is this reported back to FCM? Does FCM know not to send a notification to that user and if so, is there anyway of pulling that info out of FCM.
The reason for this question is if the user hasn't used the app in a while and they disabled push notifications - without the user starting the app (thus getting updated tokens/checking for permissions) there is no way to know the user disabled push notifications - unless we can extract that from FCM.
And along these same lines, if a user has uninstalled the app, does FCM get updated that the token is now invalid due to app removal and removes it from its db - and if so, is there anyway to way to extract this from FCM?
In both cases, we need to either update our DB that the user has disabled push notifications (and possibly use alternate communication methods) or mark the user as 'uninstalled' and thus remove that user from any app communication method (fcm, sms, email).
I am coding a vue.js app using web pushes with Firebase Cloud Messaging and I wondered if it was possible to send a web push to a user and in case the user was offline, to somehow store it for later display when the user opens the app again. Is there a principled approach to this problem, i.e. managing web pushes when the end user is offline?
The reason I am asking this is that, so far, all the web push notifications I've committed to FCM server with tokens of offline clients (i.e. desktop browsers) went into oblivion. To be sure, FCM didn't try pushing the notification again when the clients went back online.
For this reason I am considering coding a self-made dispatcher to manage web push for offline clients, but I need to make sure my efforts are worth it.
updated: I am now able to display notifications sent to an offline client after coming back online using appropriate time_to_live values. However, only the latest notification is displayed. How is there any specific reason why?
FCM's default behavior is exactly like that. From the docs:
If the device is not connected to FCM, the message is stored until a connection is established (again respecting the collapse key rules). When a connection is established, FCM delivers all pending messages to the device.
i am using ejabberd server for chat application. The scenario is user A and user B doing chat. user B goes offline and then come online. user B get the all message with push notifiacation. But the issue is when user B goes offline still user A get typing notification from ejabberd. anyone can help me in this. It there any feature in ejabberd to handle this notification or i have to use filter and client side.
Typing notification is defined in XEP-0085: Chat State Notifications. It is purely client-side.
Clients are supposed to send update about their own state, but of course, the right thing to do for a receiving client is also to dismiss the typing indication when a resources get offline.
I am writing back end for mobile app, we are sending pushes (something like one user add
another to buddies) he should accept it or decline via push notification(it is required), server got some feedback from notification, and do something.
I am familiar with two techniques about pushes, first I push directly on device using token, second is abstraction when user subscribes for channel and I send push notification on this channel. Id in my application is email, and I suggest to update device token in the database each time user login, and send push on it, but how should I identify device OS ?(IOS/Android)
1) How to scale it, if user have multiple devices, and when user will logout, and login from other device ?
May be there is common solutions for this problem.