Server push notification implementation
Solution 1
There are good articles available over internet, you can go through you will get answers. However I am trying to answer your question: Answers are mostly true for android and google servers.
Ans1) They have their listeners which has to be used by you by using their library classes in your code. You need not to bother about pushing. You have to send the message to server server will push the message to the device. They use OAuth. Regarding Protocols, there are two methods using CCS and XMPP. CCS just uses XMPP as an authenticated transport layer, so you can use most XMPP libraries to manage the connection. To send notifications to device you can write code in android app to send as well as your server code. the message sending will be done only by your code. Rest will be taken care by Google Server in GCM case. You can check detail at this link
http://developer.android.com/google/gcm/server.html
Also, for security issues
google cloud messaging security https://groups.google.com/forum/#!topic/android-gcm/M-EevBitbhQ
Ans 2) Yes in case your app is not running then also devices vcan recieve notification because you have to write code for broadcast listeners. In background it will be listening to server and whenever any message packet will be there it will recieve the message as notification. Android has service you need to not to bother about it. You have only to use those resources using the library class that makes your work easier and let them write if your app is not running then also it recieve notification. Obviously, there would be some listener whick make the app to recieve.Check "Recieve the message" section in this link
http://developer.android.com/google/gcm/client.html
Ans 3)- Firefox OS Push Notifications are designed for one thing – waking up apps. They do not deal with data. Check this link
Ans 4)- No it will acccept request from users also. I am not sure for others, but for GCM it will do. Please check "Send a message"
http://developer.android.com/google/gcm/client.html
Hope this helped you with your question.
Solution 2
Apple push notification is controlled by iOS not your app. Thus this is available even if the app is not running. To send a notification you open an ssl connection to the apple server and send the push notification payload. There is no polling or anything since iOS will handling everything.
If you intend to write your own server you can not user push notification and will drain the battery since you will be needing to pull message from your own server. Apple APNS is controlled by iOS, it connects to Apples server once is a while and collect all push notifications for all apps on the device.
Solution 3
Technical details aside, there are various third party solutions such Amazon SNS. Per million notifications should be about $0.50. Comparing this tiny cost than implementing your own servers/services (time, costs, reliability), I feel you should spend the time on other aspects of your project.
Related videos on Youtube
Kanagavelu Sugumar
love to be a problem solver & be a designer..
Updated on June 30, 2022Comments
-
Kanagavelu Sugumar about 2 years
Group,
I am planning to implement my own Server push notification server to Android/IOS apps. So My application server (which may be implemented through NodeJs) will contact that Notification Server to push messages to devices. So i surfed through internet and found the below existing solutions.
Google cloud messaging
Apple push notification service
Firefox os push notifications
Microsoft push notification service
Q1)
On their respective sites; they were informing only about how to use their notification Server. However i need info on how they implemented their server push.Please tell me; are they following any of this below?
Polling
Long polling
Streaming
Server Sent Events
TLS, SSL or TCP socket connections with Client
XMPP
Q2)Below two methods are claiming that though my app is not running; they can still be able to sent notification to APP? How is that possible?
Apple push notification service
Firefox os push notifications
Q3)
In Firefox os push notifications; they have informed that they were avoiding keep-Alive to save battery life. My question is without keep-alive how to determine the connection is still alive or not ?
Q4)
Is this all these (GCM/APNS/FireFox OS) implementation is only Server side pushing, and won't accept requests from Client. Am i correct?
So still my server has to handle millions of device requests other than push messages, right?
If i use websocket between my own notification server and client devices, do i need to maintain one more websocket connection between my application server and clients to receive requests from devices ?-
rckoenes about 10 yearsNo, your server should communicate to the Apple Push Notification server. If you intend to write your own server you can not user push notification and will drain the battery since you will be needing to pull message from your own server. Apple APNS is controlled by iOS, it connects to Apples server once is a while and collect all push notifications for all apps on the device.
-
Kanagavelu Sugumar about 10 years@rckoenes Could you please add this as answer?
-
-
nobody about 10 years$0.50 per million. Hopefully if your app gets big enough to be generating a billion notifications, you're taking in enough revenue to cover the $500 charge.
-
Kanagavelu Sugumar about 10 yearsI want to implement my own PUSH notification server, i dont want to use third party servers like GCM... Can i use websocket on my Notification server ..?
-
twb almost 10 yearsIt's by AWS not Google. In my opinion even if it has reached $500/mil, it is still probably very cost effective compared to setting up and maintaining your own cluster of notification servers to reliably deliver.
-
Alper Turan about 9 yearsYou make it look like Apple Push Notification does magic, but it doesn't. You can replicate the same thing with an idle one-way persistent connection to your own server, which gets awaken when the server wants to. The only advantage of Apple Push Notification is that you have a shared idle connection for all the apps/games. I can't speak for Apple Push Notification but from my experience with push services on other mobile operating systems they are all but reliable. There are also many posts documenting such issues.
-
Alper Turan about 9 yearsAs a rule of thumb if I have to build a reliable and maybe safe app, I'll choose to roll my own push system. If you build more than one app you can go as far as sharing your own idle connection between them.
-
Sujay Phadke almost 7 years"There is no polling" - seems to be wrong. What you mean is there is no polling required by an app. The iOS running on every device must poll some server at regular intervals to receive the notifications correct? How else can it be implemented?