Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Server push notification implementation [closed]

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 ?

like image 743
Kanagavelu Sugumar Avatar asked May 05 '14 06:05

Kanagavelu Sugumar


People also ask

Do push notifications work when app is closed?

Let's start with Android. The Android OS is designed to listen for push messages and upon receiving one, wake up the appropriate Android app to handle the push message, regardless of whether the app is closed or not.

Does an app need to be open for push notifications?

Push notifications can be sent without the app requiring the user's contact information (note that the app must first ask the user for permission in order to send push notifications).

Do push notifications work when app is closed iOS?

Apple does not offer a way to handle a notification that arrives when your app is closed (i.e. when the user has fully quit the application or the OS had decided to kill it while it is in the background). If this happens, the only way to handle the notification is to wait until it is opened by the user.


2 Answers

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

https://hacks.mozilla.org/2013/07/dont-miss-out-on-the-real-time-fun-use-firefox-os-push-notifications/

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.

like image 67
ajitksharma Avatar answered Oct 03 '22 08:10

ajitksharma


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.

like image 28
rckoenes Avatar answered Oct 03 '22 07:10

rckoenes