I have a Java based app server and a cordova client. I want to use GCM with the existing cordova gcm plugin code which uses HTTP to communicate with GCM, and use XMPP for GCM communication in my server to make it more efficient. can this be done? I am asking because I get ACKs on my server but no messages arrive to the client.
Thanks.
Found the problem, it was in the client side. The answer is yes, it does work.
Related
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.
Is there any way to login into a GCM server and receive messages from a Desktop Windows C++ application? I want to be able to login into my GCM server using some kind of C++ GCM client.
Thanks in advance,
GCM Client
SEE ALSO
Getting Started GCM Server A GCM client is a GCM-enabled app that runs
on an Android device. To write your client code, we recommend that you
use the new GoogleCloudMessaging APIs. The client helper library that
was offered in previous versions of GCM still works, but it has been
superseded by the more efficient GoogleCloudMessaging APIs.
A full GCM implementation requires both a client implementation and a
server-side implementation. For a step-by-step guide to creating a
complete sample implementation that includes both client and server,
see Getting Started.
I think it is designed for android device.
Probably you can hack and install a whole android somewhere but, buy is easier in this way:
Write an Android client as google expect to a cheap phone (20$) When you receive message send it over wifi to your desktop Apache server via HTTP POST, and problem solved, simple :)
Google just announced a new api for GCM to IO13 that using the xmpp protocol. Is it possible to use this api with appengine? It does not look like it would work with appengine's XMPP support, but perhaps with the new Sockets api. Can this be done from a frontend, backend, or both?
This is not possible with current GAE XMPP support. The problem is user/server addressing: GAE XMPP API sends messages to users defined by email addresses. It then performs a DNS lookup for the XMPP server SRV record (e.g. dig srv _xmpp-server._tcp.gmail.com +short to look up the XMPP servers for #gmail.com addresses). This is not how GCM CCS works - you have to connect to fixed server.
OTOH, you could use Outgoing Socket API and then implement XMPP protocol.
Google Cloud Messaging Team told me:
'Google App Engine does not currently support connections to CCS.'
I was looking at the source code of the simple python-xmpp,
it looks pretty easy to port to App Engine, it only need python dns,
there is no other third-party library requirement.
Only XMPP endpoints GCM Cloud Connection Server needs XMPP support when you want to stream your message. If AppEngine doesn't support XMPP, you can use older GCM HTTP messaging instead. Only HTTP POST requests are needed to send message to your device.
I propose a new question:
I think the communication between android and server by sockets is difficult
I speak with my friends it proposes me a solution: use the GCM
month then give an idea or example uses this concept
I found this book:
http://www.academia.edu/2200380/SENDING_SECURE_DATA_BETWEEN_AN_ANDROID_MOBILE_APPLICATION_AND_A_NETWORK_GROUND_STATION
And the question is, how to use gcm between server and Android?
Communication between android and server is I believe not applicable with GCM, GCM is intended to be a server to client pushing service, for example your wish to tell your client there is some data updates you need to fetch. So your server will push a message to client, using GCM.
For client to server communication, the easiest IMO would be using some Http server or web services. As for securing you can always go for SSL.
I am trying to create a chat application. The communication is based on RESTful web services(Jersey). The client communicates with the server sending HTTP requests. My problem is how to send messages from server to client without the client send a request first. I read about C2DM notifications, I suppose using this way, when the client receives the notification from the server then (the client) has to send a request to the server in order to receive the data. I also was thinking about using sockets but I don't know if it is possible as I am using Rest. I mean in the server side can I also use sockets(sockets run in lower level) with the REST code? The only thing I have though that could work using sockets is to create another server with socket(two servers RESTful and socket), but is this a good solution? Also could I put some server code in the client side and some client code in the server side. Would it be correct and effective? What do you think? Which solution would be the best?
C2DM has been officially deprecated as of June 26, 2012 by google. Existing C2DM developers are encouraged to migrate to the new version of C2DM, called Google Cloud Messaging for Android (GCM).
Check out this link for more info
http://developer.android.com/guide/google/gcm/index.html
The scenario you describe sounds ideal for C2DM. If you build your own sockets set up you will drain battery and CPU resources doing something the phone is already doing - maintaining an open socket to receive messages.
C2DM is relatively straightforward to set up, and in my experience is pretty reliable.
This is the best tutorial I have seen on it:
http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html
But you also need to read the official docs:
http://code.google.com/android/c2dm/
Your server-side code will need to send an HTTP request to the C2DM servers to send a message to a device. To tell it where to send the message, your server needs to specify the Registration ID (which represents your app running on one specific device) and so when your app sets up on the Android device, it registers with C2DM, and then needs to send its C2DM Registration ID to your server to be stored, ready to be used to send messages to.