Best way to communicate the Application with the Server [duplicate]

2

I'm developing an application that needs to communicate with the server (send and receive data). What would be the best way to do this data exchange with security and performance? Through REST / WEB SERVICE, Sockets, HTTP request or some more specific?

Note: It amazes me how WhatsApp receives information, instantly and slowly, would this be an example of Sockets?

I'm waiting for a suggestion.

    
asked by anonymous 11.03.2015 / 18:30

1 answer

0

To connect to the server, you can use the Volley and the OKHTTP library. To make simple requests you can see in the post HERE

In the case of Whatsapp you said, you would risk saying on their server that they have an implementation of Google Cloud Messaging (GCM). The GCM works so that whenever the user installs and runs the application for the first time, it registers to the google server and the server returns a key that will identify the application on that device, then the app sends that key to the server (in this case whatsapp) and saves it to the bank associated with the logged in user. Whenever another user decides to send a message to this user, it goes to the table that has the key record associated with the user and this same server sends a message to the GCM with the key and the message and google delivers the information as well that the user or app is available.

More on the subject see the link HERE

    
11.03.2015 / 19:09