[RUBY] How to send push notifications on AWS

If you want to push on AWS, there are two services:

SNS There are two patterns in SNS, either send a push to each user or register a user in TOPIC and send to that TOPIC.

Screenshot 2020-12-18 at 14.39.19.png

Sns flow

Create an application for the application on SNS, register the endpoint (user's DeviceToken) in the application, and send the endpoint. After sending, check on SNS whether it was possible to send to that user. If you want to send to each user, the SNS soft limit will send 1500 items per second.

But you can send not only 1 <> 1 but also Topic.

What is TOPIC?

Topic is a destination endpoint, an endpoint that can register up to 1.2 million endpoints. The endpoint will be the "place where you can send" in SNS. For example, this app uses 100 users, if you want to send push notifications, register the users in the application of SNS and send it to each person, but if you want a faster method, when registering in the application Part 1 is to subscribe to Topic. If you subscribe to 100 users, you can send to 100 users with one request when sending to Topic.

It doesn't change for 100 users or 1 million users!

Screenshot 2020-12-18 at 16.58.41.png

The nice thing about Topic is that if the transmission speed is fast, AWS API is only once.

pinpoint

Pinpoint is a much talked about service and is now available in Japan this year! Unlike SNS, you can register 100 users at once and push at once!

The push flow of pinpoint is simple, create a segment and import the user's file when creating the segment Screenshot 2020-12-18 at 16.09.33.png

File sample

import.csv : ChannelType,Address,Location.Country,Demographic.Platform,Demographic.Make,User.UserId APNS,482aba02e7da338707541bb4c4a570b0ec090b8b0001b28ae1634ee680f2cbc4,JP,iOS,Apple,255830951

CSV or Json that combines the user's deviceToken with the platform and other information.

After creating a segment, create a campaign for that segment, set up push (title and message) and send (you can send repeatedly), and you're done!

Screenshot 2020-12-18 at 16.23.25.png

The transmission speed is fast, and 20,000 items are sent per second.

But

Screenshot 2020-12-18 at 16.26.04.png

You can get the transmission rate, but you can't do it without knowing who you could send it to. I can't even uninstall any user. It's subtle that you can't identify the user even though it's called Pinpoint ... Besides, for cheap SNS, Pinpoint is expensive if there are a large number of users. https://aws.amazon.com/jp/pinpoint/pricing/

Free up to 1 million notifications, then $ 1 per million notifications. Free up to 5,000 MTA endpoints, then $ 1.20 per 1,000 endpoints.

So one push costs $ 2,400 a month for 2 million users. Pinpoint is not suitable for my own usage, it seems that I can do it if I want to send a lot of pushes on the district court user base.

SNS-Pinpoint

How long does it take to send 2 million users to make a decision (send time and price):

Screenshot 2020-12-18 at 16.40.07.png

Both SNS and pinpoint have good points, but as for this request, Topic is the easiest to use if there are large target users.

that's all

Recommended Posts

How to send push notifications on AWS
How to deploy a container on AWS Lambda
How to save images on Heroku to S3 on AWS
[AWS] How to check logs
How to deploy on heroku
List how to learn from Docker to AKS on AWS
How to create an application server on an EC2 instance on AWS
How to get inside a container running on AWS Fargate
How to deploy a Rails application on AWS (article summary)
How to deploy jQuery on Rails
How to push from Tarminal to GitHub
How to deploy Laravel on CentOS 7
How to "hollow" View on Android
[Java] How to update Java on Windows
How to install ImageMagick on Windows 10
To beginners launching Docker on AWS
How to deploy Bootstrap on Rails
How to run JavaFX on Docker
How to use Bio-Formats on Ubuntu 20.04
Receive parameterized PUSH notifications on iOS
How to install MariaDB 10.4 on CentOS 8
Rails on Tiles (how to write)
[Swift] How to send a notification
How to install WildFly on Ubuntu 18.04
How to build vim on Ubuntu 20.04
How to create a web server on an EC2 instance on AWS
How to check Java installed on Mac
A memorandum on how to use Eclipse
How to redo a deployment on Heroku
[Ruby on Rails] How to use CarrierWave
Sample to display (head-up) notifications on Android
How to detect microphone conflicts on Android
How to install Eclipse (Photon) on Mac
How to publish an application on Heroku
How to install production Metabase on Ubuntu
How to switch Java versions on Mac
How to install beta php8.0 on CentOS8
How to change the timezone on Ubuntu
Java: How to send values from Servlet to Servlet
[Ruby on Rails] How to use redirect_to
Send an email using JavaMail on AWS
[Ruby on Rails] How to use kaminari
[Ruby on Rails] How to display error messages
How to configure ubuntu to be used on GCP
How to add / remove Ruby on Rails columns
How to make rbenv recognize OpenSSL on WSL
How to install network drivers on standalone Ubuntu
Send push notifications using Notification Hubs in Java
How to use Java framework with AWS Lambda! ??
How to install NVIDIA driver on Ubuntu 18.04 (Note)
How to deploy
Notes on how to use each JUnit Rule
[Heroku] How to solve when an error is displayed on git push heroku master
Note how to rollback Mysql deployed on Heroku
How to install multiple JDKs on Ubuntu 18.04 LTS
[Ruby on Rails] How to install Bootstrap in Rails
How to build a Pytorch environment on Ubuntu
[Ruby on Rails] How to use session method
[Java] Memo on how to write the source
Notes on how to create Burp Suite extensions
Notes on how to write comments in English