My application uses websocket to deal with push notifications when the user has the app open in his browser ( active tab or not ).
My backend is responsible for emitting events via websocket that I catch on frontend thanks to socket.io, and then display it with browser native Notification system.
What I want to achieve here is having a service worker to display those notifications even when the user isn't on my app webpage or has its browser closed ( Like Facebook, YouTube, Asana or Slack does ), but after a while searching for resources to do so, I can't tell if it's even possible to do it without using third-part services like Google GCM.
Is it possible to catch events from my websocket backend inside a service worker to show notifications ? And if so, how may I proceed ?
Related
I am reading the Web notification API and I want to send notification like they are on iOS or Android (ex: You have 7 new messages).
Considering I have accepted notification from www.my-foobar-super-site.com, can I, after authorizing notification from it, can my website send Web notification to a user when this user has no tabs open of this website?
After accepting web notifications, can a website send notifications when browser has no tab open of this website?
Yes, but there's more to it than just a user granting the notifications permission.
The Web Notifications API is only concerned with displaying messages on-screen from a script already running on the user's computer, it is unrelated to "push notifications" or delivery.
To send "push" messages to a user's browser, you'll need to use the separate Push API - and run a Service Worker to receive messages from your service (via the Push API) and only then can your script use the Notifications API to show the notification message.
Yes, as long as you have registered a service worker.
I've build a Javascript WebApp that is designed to work on tablets (using Web App Manifest file) and offline (aside from getting initial data from PHP backend). The app has custom notification system imitating Notifications API. Each notification is sent at given time (using setInterval). This leads to couple of problems:
there is no sound as the notifications are not effect of user interaction,
notifications can't be shown when the device is asleep.
First problem can be solved using Notifications API, but I'm not sure what could be done about the second. Keep in mind that the app should work offline - this eliminates the use of Push Notifications API.
Is using web application's container such as Cordova my only option?
Iam trying to build a universal web application(producer) which uses my own interface and its build using Alljoyn Studio.
Now i want to add the notification service, to send the notification to the consumer which is a (android)application.
how do i implement the notification service/Control panel in UWP?
please provide me some suggestions.
For sending Notification to any android Device you can use two technology: 1) Push. 2) Pull.
For Push Technology you can use GCM(Google cloud messaging).
For Pull Technology you can make you application continuously keep on connecting to server and trying to fetch data if it is available from there.
Advantages of GCM:
1) Low battery comsumption. Since it will push the message to user device and it will push message when user gets connected to server.
For GCM you can use following Link for your reference:
http://developer.android.com/google/gcm/gs.html
https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web?hl=en
http://www.techrepublic.com/blog/app-builder/implementing-googles-cloud-to-device-messaging/428
http://www.vogella.com/articles/AndroidCloudToDeviceMessaging/article.html
https://github.com/teleknEsis/TechRepublic-Samples/tree/master/C2DMSample
I'm working on a hybrid app that is based on Angular 1.5. In part of the app now, the client wants a messaging system for the admin of a group to be able to message the normal worker/user. I want to check and see if this is done, would server sent events be the solution? If so, do I continue to let it run as the user has the app open? How does this affect performance?
I am presuming authentication would need to be performed against users in order to differentiate between admin and worker accounts.
Have Angular send AJAX calls to your server, which will check the users' authentication status before the client-side view is rendered.
You should research the resolve property in Angular in order to implement this type of solution.
I'm trying to understand how to send notifications using the browser when my website is closed.
I see that Facebook does it but I can't get how.
Any help is welcome.
You are looking for the Push API:
The Push API gives web applications the ability to receive messages pushed to them from a server, whether or not the web app is in the foreground, or even currently loaded, on a user agent. This lets developers deliver asynchronous notifications and updates to users that opt in, resulting in better engagement with timely new content.
And the Notifications API:
The Notification interface of the Notifications API is used to configure and display desktop notifications to the user.
You must use these in combination with a Service Worker. From the Push API documentation:
For an app to receive push messages, it has to have an active service worker. When the service worker is active, it can subscribe to push notifications using PushManager.subscribe().
You can use Roost. Roost is a push notification platform for websites. You can see its documentation to perform both client-side and server-side integrations, so that you can customize your Roost notifications as needed.