Do I need a database server as an intermediary when using GCM if I don't have data to store?
It looks like this is what is currently needed:
Client 1 -> backend -> GCM -> Client 2.
But I'm not sure what the backend server will do in my scenario where I don't want to store any data. I just want client-to-client interaction through GCM:
Client 1 -> GCM -> Client 2.
Is it possible?
In GCM, the sender (usually the backend) must have an API key that you get from the Developer Console. This API key is used in every HTTP request sent to the GCM server as a form of authorization to send messages.
The client needs to register using the Sender ID that comes from the same project on the Developer Console where you got the API key. This results in a registration token that the client sends to the server / sender. This token is what identifies the client device from other client devices.
Note that the above scenario only applies to a single sender-multiple sinks / clients setup. If you need more than one device to be able to send, you will need to allow the other device to track the registration markers of its receivers. This complicates the complexity a bit.
At a minimum, you actually have data to store: device registration tokens that will receive messages from the sender. However, the sender also needs to track responses (for debugging and monitoring purposes). Having said all that, while you could technically use your client device as a server / backend, it runs a lot on the device and is difficult to maintain. I highly recommend setting up at least a very basic server.
Hope this helps!
source to share
GCM is for sending notifications from the backend to the device and vice versa. https://developers.google.com/cloud-messaging/
Thus, the following options are possible:
Client 1 -> Backend -> GCM -> Client 2. (HTTP)
Client 1 -> GCM -> Backend -> GCM -> Client 2. (XMPP)
source to share