my team is building an android instant messaging app (like weChat or Line) and we heard that gcm can really make things easy for us
But while I was reading about google cloud messaging service, I realized that there were few components that must be thought of before doing the project
So I am guessing that there are 3 parts to gcm: gcm server, app server(3rd party), and application itself, and the question i have is with app server. I understand that gcm will work as a xmpp server, but what about the app server, does it have to be xmpp server as well? or can it be any server that can just send http request to gcm server? Thank you
There are two ways to connect to GCM server. The simple way is sending HTTP requests to GCM server. This gives you cloud to device (server to application) messaging functionality.
The more complicated way is to establish an XMPP connection with the GCM cloud connection server, which gives you both cloud to device and device to cloud messaging.
If you don't need device to cloud messaging (which mean sending messages from your application to your server via the GCM server), your server will only have to send HTTP requests to GCM server.
Related
I am developing in Android for GCM. I want to implement like the following:
Phone Server <--> GCM Server <--> Phone Client
I have try to use Http post to the GCM Server , and the client can receive the broadcast data from Http Server.
But the client seems can not upstream the message to the Server via GCM by using Http.
So it need to use XMPP Server on Android side for receive the upstream message from Client. But it seems few information about this.
How to implement XMPP Server and communication with GCM on Android ?
Thanks in advance.
You may implement an XMPP Server through Google Cloud Messaging (GCM) Cloud Connection Server (CSS) is an XMPP endpoint that provides a persistent, asynchronous, bidirectional connection to Google servers. The connection can be used to send and receive messages between your server and your users GCM connected devices.
Implement the XMPP Connection Server can receive upstream messages from a user's device to the cloud. To initiate an upstream message, client app must send a request containing the address of the receiving app server, message data comprising the key/value pairs of the message's payload and a message ID should be unique.
Here's a useful documentation on how to Implement an XMPP Connection Server: https://developers.google.com/cloud-messaging/ccs
I have been working on GCM xmpp implementation for my chat functionality, but about a week, I am not getting online help to start with , I have got this XMPP GCM Android tutorial, but I see xmpp is not fully implemented, and upon seeing their code, it is very unclear to understand the functionality
firstly. my current structure is
Android client app for chat functionality.
java backend, app server jboss hosted in openshift cloud platform.
and according to this google gcm-xmpp image.. I see client interacts directly to gcm, which I get confused, intern gcm connects app server.
as per my implementation, I get gcm regid from gcm and send http request to app server which intern send notifications to client devices through gcm. this is reverse of what we see with gcm flow diagram
secondly, since I have already set up app server Jboss, which can handle http request for my client request other than chat functionality. now I need to implement xmpp for handling asynchronous, bidirectional, upstream messaging with another servers like openfire or ejabberd which supports xmpp.
currently I am in state where I don't know how to start with xmpp, I have got above queries, in the hope getting some directions to start with.
Can anyone explain how to make a basic IM client with my old PC as a server, client can be on IOS or android? And also please explain how to work with IM and servers simultaniously.
For android you could use Google Cloud messaging and a similar messaging service for IOS. When a client send's a message, it should be sent to GCM via upstream service and GCM will push the message to the server. The server will house the deviceId's of the client's and can push a message whenever required to the client by making a API call to GCM with the message and the deviceID.
Check the documentation for GCM and you will get a clear idea.
There are also other services like GCM which can work for android as well as IOS
The reason for using such a service is that it ensures that the messaging is full proof. Even if the client is not having internet connectivity or is switched off, it shall receive the message on getting internet connection. You do not have to handle those troubles!
I am trying to build a chat application with the Google Cloud Messaging, something similar to whatsapp. Do i need to use 'CCS: Upstream and downstream (device-to-cloud, cloud-to-device)' OR 'GCM HTTP: Downstream only: cloud-to-device' would work just fine?
GCM HTTP is easier to use and supports Cloud to Device messaging. If all you need is for your server to notify your app when a new message is available, GCM HTTP is enough.
The Cloud Connection Server is only required if you want your app to send messages to your server via its connection to the GCM servers. It's useful if your app needs to send a lot of messages to your server.
I would like to use GCM (Google Cloud Messaging) and was wondering if it was possible to set it up on Windows Server (IIS) instead?
Currently my web services are all hosted on Windows Servers as WCF services. I'd like to avoid having to have a dedicated server for GCM.
Instead of what? Any server connected to the internet can be used as a sender of GCM messages. Your Android application has to be able to connect your server in order to pass the device Registration ID to it. And your server has to be able to send POST requests to https://android.googleapis.com/gcm/send in order to send the messages.
Or as stated in the GCM Documentation :
Before you can write client Android applications that use the GCM
feature, you must have an application server that meets the following
criteria:
Able to communicate with your client.
Able to fire off HTTPS requests to the GCM server.
Able to handle requests and resend them as needed, using exponential back-off.
Able to store the API key and client registration IDs. The API key is included in the header of POST requests that send messages.