I am trying to integrate push notification in a web app(also PWA). I am using Mercure(https://symfony.com/doc/current/mercure.html) to send notification to users.
The webapp is made using Angularjs and PHP-symfony. I think for SSE the connection should remain open or re open every few seconds to send an event.
I don't know if it will work for PWA. Can I send a push notification using SSE to a PWA even when it's not open? If not, what should I use to send a push notification.
Should I use websockets? All the libraries for websockets I've seen create channels. And I don't know how to send a notification to a particular user in my database because in websocket, the only way to distinguish a user is a sessionId that's generated when they join the channel.
I will probably have to save the sessionId of the user in database when they login and join a common channel in the application and find sessionId of users I want to send a notification to and then send.
My question is, if I use SSE, can I send push notification when the webapp or PWA isn't open. Will websockets help? If yes, please give a suggestion on how I do what I want to do.
Related
is there any way out / resource which can guide how we can send the push notifications through a javascript to a specific user (through a device id). We have a web app that contains of a login functionality backed by MySQL. We want to send specific alerts to the specific users who are registered. We are open to take any more hidden detail of user if required to complete this task.
We are currently using the JS push notification library to send push notifications but thats currently static not dynamic.
You could run an ajax-call in the background which calls a script with the user-id as an parameter and that returns the messages you want to show to the specific user. Then you can show the message to the user.
I want to add browser notifications for my rails app.
I'm having trouble adding notifications to specific users.
For example, i have user and lesson models.
And I want to send notifications to the user about the beginning of the lesson.
But how do I send notifications, not to all users, but only to those related to the lesson?
The first thing you should do is to get and store the subscription object for each user. Then, in your application, you should send a notification only for related users.
There are a bunch of different gems for it, e.g. https://github.com/zaru/webpush
I'm looking for ways to handle push notifications from PWA and Native apps.
We have both, and now when we send a push, I want that if user has installed both native and pwa on their mobile, to only receive the push from native, so we would avoid spamming the user with dublicate notifications. We are using Firebase for push notifications.
What are the best practices to handle this dublicate notification issue? I couldn't find any related info on the web.
This can only be achieved if the user is logged in. In this case you can store the user-identity together with the push notification token. Then on the server you can check which user has registered two notification tokens and send your message only to one token.
If your app does not provide any user identity, I see no way to achieve it.
But, are you sure this is the desired behavior?
Keep in mind that the user can have more than two tokens, for example if he uses your pwa on multiple devices/browsers.
I am building web application to keep track of activities of users using an Angular front-end and the back-end using PHP. User click start button, what activity he/she is doing. When user click the start button, timer start to run. But sometimes user may forget to stop timer or just close the browser. What i want to is to notify to the user desktop with some notification something like web push notification when activity goes too long. And my question is
1.Is it possible to notify the user when he/she close my web in browser,but his/her desktop is on? and how?
2.How to send push notification to the user desktop without interacting with server?
I see some tutorial like push notification where server send notification but I have nothing update in database I have my clock running in AngularJS. So I have to check clock time also in Angular. As Angular is a framework of JavaScript, I am comfortable with JavaScript too. Any ideas how to use GCM or ServiceWorker or push notification. I am new to GCM, push notification and service worker.
Any suggestions?
here is what I want to do:
on a website: www.mySite.com
I want ppl to log on and be able to see other ppl who are currently viewing that webpage.
then I want them to be able to enter text on the webpage and it sends a message to the server
the server then sends this message to all the ppl viewing the page.
then I want the option to select a user from the list of users currently viewing the webpage.
and send that user alone a message (private messaging) but not all the others.
can I do this with html and php? I do NOT want to have a browser refreshing constantly to reload data.
I have looked into websocket technology and so far the only solutions I found is to open a socket connection, wait for a response from server and close the connection on timeout...
then reopen a new one and continously open and close sockets until updates are received by server.
is there a way for the client (browser) to listen for updates without polling a server?
-->>>is there a way for the server to save client addresses and send updates to an open html page (push data) to all those clients, only specific ones, or whatever the case is??<<--
html seems to work fine polling servers but then close connection right away.
Is there a way to keep a socket open indefinately, and not constantly reopen them to simulate server-browser push technology?
I am coding with a simple webserver using html, php and javascript. I am not paying for a virtual machine where I can construct services in my language of choosing.
I prefere not to use a 3rd party to achieve this.
I would like for this to be working on all browsers.
is this possible?