rpush vs sns for large scale push notifications - ruby

Currently we use Amazon SNS to deliver push notifications to our Android and iOS mobile apps. SNS seems to miss a notification once in a while and there's a particular kind of notification that we can not afford to not deliver. Is there a method that guarantees delivery of every notification while still using SNS? An option I'm considering at the moment is using the rpush gem, but I would like to know how well it performs as compared to SNS.
The backend is written in Ruby/Sinatra.

Related

Alternative of cloud functions

I am developing an app for elderly for my graduation project. There are 2 actors, elderly and the watcher who takes care of elderly.
'all application data stored in Firebase'
My app reminds elderly about their medication time and to check their blood pressure and glucose.
Also, there is a chat between elderly and watcher.
My question is how to push notification without using cloud functions?
I have watched a Flutter course and he used Firebase Cloud Messaging and Cloud Functions, but now Cloud Functions requires to upgrade project's billing plan, so it requires money and credit card, and I don't want to spend money for my graduation project especially that I don't have a huge knowledge about flutter.
I watched a YouTube video that someone explains push notification using Laravel with Flutter, but I afraid about that because I DON'T HAVE ANY IDEA ABOUT Laravel.
Also I see that there are many Flutter packages for push notification, but I don't know how to use it or if it uses a Cloud Functions or not. such as: awesome_notifications, flutter_local_notifications, pusher
I hope someone guide me to the right way.
in order to send custom notifications you can create your own server environment (backend) and from there perform all the logic to be able to send the notifications to the devices.
The only thing you need to be able to send a personalized notification from an external environment is to have the token device, in the case that you will send it to a specific person, you can also send notifications if the devices are subscribed to a topic.
This is the documentation to send notifications from a server to the device:
https://firebase.google.com/docs/cloud-messaging/http-server-ref

Why do i need GCM or APN?

Why can't the individual app servers directly send notification to their mobile apps ? What is the benefit of having a centralized notification platform ?
From this thread, GCM is a service that helps developers send data from servers to their Android applications on Android devices. Same with APN which is a service for app developers to propagate information to iOS (and, indirectly, watchOS), tvOS, and macOS devices.
You may check these threads:
Why it is preferred to use GCM for push notifications?
Let's say you have 50 applications on your phone that do not use GCM. Each app developer decides it is appropriate to poll their respective backend once a minute.
Since these are all separate applications, each call will likely not happen at the same time as another api call. The biggest kill to battery is when the radio within an android device has to turn back on after being off to make an API call, so multiple calls happening with blocks of time in between drains battery faster (read this article on the radio state machine to better understand why this is https://developer.android.com/training/efficient-downloads/efficient-network-access.html)
In addition, each application will be hitting a separate endpoint. Each time you make an API call, you have to go through the connect process for a given server. With batched api requests or HTTP 2.0, multiple calls going to the same server can be optimized by not having to re-do a handshake or the connect process.
What are some advantages of push notifications?
Wide reach across internet users.
High conversion rates.
Real-time communication.
Push Notifications Explained
Hope this helps!

Migrate push notifications to FCM or Amazon SNS?

I'm using legacy binary APNs and GCM and now I want to upgrade to their newer versions of these services, as recommended on their websites. All I need are push notifications to both iOS and Android devices, though I'd like to add "scheduled notifications" or "bulk push notifications" feature as explained in Firebase Notifications docs.
I'm curious what are the reasons why would someone with these requirements choose Amazon SNS over FCM? Are there any downsides choosing FCM? Is this just a personal preference, meaning the both services will work great for these requirements? Thanks!
The mentioned scheduled notifications can only be done when sending the message via the Firebase Console. If you intend to have implement your own App Server and send the message using the FCM API, you would have to implement the scheduled push yourself. (See here)
For the bulk push notifications, this one can easily be implemented if you use FCM Topic Messaging.
To answer your post (which is pretty much opinion based), I haven't actually used Amazon SNS before, but going with FCM not only allows you to use the new features (compared to GCM), but it can also be a starting point for you to use the other services (Realtime Database, Analytics, Authentication, etc.).

How to build real time notifications in a distributed project?

I wonder to know which technique and tools I should use to have the ability to send real time notifications to users. Specifically if I build a messaging system.
I can see that modern social networks can send notifications about new messages almost immediately. Even when the user 'A' from one country writes a message to the user 'B' in another country you can see that the user 'A' writes a message and you immediately see it (even if those users live in different continents).
I tried to figure out how it is possible and find any information about this but without success.
The only thing I found out is the technique when we use a Redis or RabbitMQ server with several servers which acts like publishers and subscribers. Our API servers receive new messages then they push a new message in the queue then subscribers receives the messages and if they have an open WebSocket with the recipient they push this message in the WebSocket and a client receives the message.
But it really won't work if you have a distributed project and your clients are connected to the nearest servers in the nearest data center.
The question is: what technologies/techniques/anything we should use to be able to build notifications in a distributed project?
If you develop your distributed app/system using web technologies, you can consider building what is referred to as a Progressive Web App. With PWAs you can add push notifications in a relatively easy way. You could start with a PWA approach, and then decide later on if developing a native app as well (i.e. iOS or Android) would be necessary.
There are many resources to learn and guide you in developing progressive web apps. Check the references I mentioned above, and you can do this codelab as a starting point.

Can I use PubNub for realtime data collection?

I'm interested in collecting realtime data periodically (say every 1 min.) through a mobile app on my server. Can I use services like PubNub or Pusher for it or are they only for communication in the other direction - like sending push notifications from a server?
If I can use, could you please explain how exactly the setup would work?
PubNub can provide bi-directional real-time datastreams on all devices, including mobile! Any phone (or server) can be a publisher, or a subscriber, or both.
You can choose your SDK of choice here http://www.pubnub.com/developers/ -- each client has docs for a simple hello world app.
If you need more assistance in getting setup with PubNub on mobile, just shoot us an email at support#pubnub.com and we will assist!

Resources