Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
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 ?
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.
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.
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
I'm some kind of backend developer and don't know how mobile applications work. But I need to provide architecture for mobile chat application server.
I know that android apps using google services to receive push notifications from firebase, so we don't need run own application in endless loop and poll for new data at server.
That is prefect for push notifications, but firebase notification body limited by 4KB and don't fit for big messages.
So I can see only one realization:
Google services polling for FCM (ex-GCM) notifications
Receive some signal-like notification
According this notification my app go to server and download new message
Update local chat data
Show generated locally notification for new message
This way is looking pretty complicated, so I don't believe that this is only possible (and correct) way.
Another way is to keep websocket session opened every time or poll server manually. But these two operations should drain battery to much.
So how modern chat apps stay in sync even if they closed and device screen off?
if you really want to make modern chat app then do some research on XMPP
These can be some best practices you can follow
setup XMPP server on backend with offline storage support
use client XMPP SDKS for apps to connect XMPP server.
use push notification in case of server connection lost to wake app
and reconnect to XMPP
try to save large files on different server and send only url with
body if you want to keep your files urls private then use any
client SDK that support implementation of uploading and downloading
private file like AWSS3
I have set up push notification from Firebase console and I can send push notifications. However, I cannot send device-to-device notification yet. As I gather I would need an external app server that would observe Firebase nodes for change and then would fire off a notification via FCM.
I have seen similar question in SO here and a good but brief and not so complete explanation by Frank van Puffelen here. But I am still quite confused. Any tutorial or help as to how I can set up an app server (XMPP here) that would do the communication between client app instances and Firebase for sending notification when ChildAdded or modified and handling the key exchanges would be appreciated. (as I understand, FCM needs XMPP protocol for sending upstream notification)
Any help would be appreciated.
Following this tutorial.
Send Notifications from Server
What you can do is, setup an external server using your favorite technology to listen child_added or changed and respond to the notification requests.
We used the node.js app engine to handle this. Again the funda is to move people to use other cloud paid services.
Yours it's a good question... The firebase can't send push device-to-device, then if you want to do this one, needs a app server as you said. The other possibility that I thought for a long time is a create a independent service to do two things, the first one is constantly controls events as onChildAdded, for exemple and the second one, throws local notifications.
This is solution that i think works fine before to create a app server... At final if you try to do it, explain us your experience please! Greetings!
I am currently building a messaging application that allows users to send and receive messages on their Android mobile phones over an internet connection to each other. I have decided that I do not want to use polling because it means that a user may not receive another user's messages as instant as possible. I have my own server available for use.
I am currently tied between using Google's Cloud Messaging for Android platform in order to send the notifications from the server to the Android device. The other option is to keep a live TCP connection between my server and the Android device via a service, and send 'keep alive' messages every 5 minutes for example.
From your best opinion, what is the best way to do this - or is there a better way? I don't want to use third parties apart from Google to do this. There are similar answers available, but they don't address this specifically.
Alex
using Google's Cloud Messaging for Android platform in order to send the notifications from the server to the Android device.
This is not a realtime notification either; the notifications may be delayed longer than you experienced with polling. Also GCM is meant for broadcasting messages to a number of users, not for targeting a message to one specific user.
The other option is to keep a live TCP connection between my server and the Android device via a service
I don't know how many users you are expecting, but this may not scale. You are limited in the number of TCP connections to one server.
No need to re-invent the wheel here, use an existing implementation such as XMPP.
Take a look at this:
https://pusher.com/docs/client_libraries
https://github.com/pusher/pusher-test-android
It may be what you're looking for
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Please suggest way to build watsapp like chat application.
In My Android application i have to put Chat Functionality
I already knows following ways.
Chat application by using GCM (Google Cloud Messaging).
Socket Programing
By using our webservice
Is there any other techniques for chatting app?
There are various methods to develop chat application.
1) Using HTTP connection (In this method each and everytime you want to send message, you have to call the webservice and for receive message, you continously need to call the webservice using Timer).
2) Using XMPP Server (XMPP server uses Socket programming, so once a connection will be establish, then it uses that connection each and everytime, you no need to create connection everytime, like HTTP).
3) Using GCM (Using Push Notification you can send and receive messages as well).
Things you need to build a chat app:
Server:
This is required to store all the user information like username, password and gcm registration id (will come to this later).
You can host it anywhere Amazon EC2, Google App Engine, etc
APIs for login, chat message sending, message list, delete message and many others.
Registration for GCM push notification:
Refer the link below:
https://www.digitalocean.com/community/tutorials/how-to-create-a-server-to-send-push-notifications-with-gcm-to-android-devices-using-python
Android:
Register to GCM and send the gcm registration id(as mentioned in point 1) to the server for updating.
Design user interface to send message, sending a message can be done either through REST API or by using socket connection.
You can explore XMPP and MQTT.
Server to Device communication and vice versa:
Now, on receiving message coming from the device, publish the message to the socket connection and as a fallback send push notification to the receiver device. There are 2 ways to do it:
i) Send the message payload along with the push notification
ii) Only send "sync" and on receiving the "sync" notification, receiver's android app can make a call to the server, fetch all the messages and show it to the user. Benefit of this approach is that the messages will never be lost. You will have to maintain the "sync" timing on the android app side.
Above was the normal way to build it if you want to learn but if you want to just get it done fast then you can integrate Applozic Mobile & Web Chat Libraries which will get you started with chat within half an hour. And the beauty is you wouldn't even need to develop or host any server.
Sample code to build chat in available in Github:
Android Chat SDK https://github.com/AppLozic/Applozic-Android-SDK
Web Chat Plugin https://github.com/AppLozic/Applozic-Web-Plugin
iOS Chat SDK https://github.com/AppLozic/Applozic-iOS-SDK
PS: I am the Cofounder #Applozic
I really tried to find a solution to this problem but didn't. There are some threads related to this concept, but I didn't find a comprehensive solution.
I have a server with Openfire which sends messages. When both users are online, there is no problem. However, when a user is offline I would like to send a push notification, as in Whatsapp. I heard that Whatsapp and other IM apps use a modified version of ejabber to send push notifications, but couldn't find out how.
One possibility is to use GCM, but I am not sure if this is the right way to go. Also I would like to avoid polling, for the sake of not draining battery life.
Does anyone know some solution to this or has an example?
I am studying the openfire and found some good options that I would like to share with you.
I found a plugin in github and i will test it this week. It seems that will be a good solution to your goal and to my: https://github.com/meisterfuu/Openfire-GCM/
Another option is to use CallbackOnOffline Plugin that calls a specified URL with To and From parameters. This url could be a endpoint in your web service, and with that data (To and From) you could get the associated Id for push in your base, and did a push.
https://www.igniterealtime.org/projects/openfire/plugins.jsp
Well, you could use GCM with XMPP.
The new GCM Cloud Connection Server allows you to use the XMPP protocol for a bidirectional (Cloud to Device and Device to Cloud) communication between your server and your Android application.
The GCM Cloud Connection Server (CCS) allows third party servers to
communicate with Android devices by establishing a persistent TCP
connection with Google servers using the XMPP protocol. This
communication is asynchronous and bidirectional.
In openfire its done automatically, messages will be recieved by the user when the user gets online. So no worries send message to an offline user and when the user comes online message will automatically pushed to the user.