E
E
Evgeny Petrov2019-05-30 12:27:13
Java
Evgeny Petrov, 2019-05-30 12:27:13

How are applications such as Whatsapp, Viber, etc. synchronized with the server?

Hello!
I am making a client-server application on android: client-A in the background thread must send its coordinates to the server every N-th number of seconds, client-B must synchronize with the server in case new coordinates appear and, if there are new ones, process them.
The thought just comes to my mind: the client-B service must make a request to the server every N seconds and check for an update. BUT! In this case, the phone must constantly perform a task, which will lead to increased battery consumption or, in the worst case, the system can be beaten for irrational work in general. Then the question arises: how then do such applications as Whatsapp work, they are instantly synchronized. What method is used?
Thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2019-05-30
@kazsat

While running, keep the connection to the server. When closed, receive new messages via FCM .

F
FullStack Alex, 2019-06-06
@FullStackAlex

I don't know how WhatsApp does it, but if I wanted to create something like WhatsApp, I would use WebSocket.
https://en.wikipedia.org/wiki/WebSocket
https://hackernoon.com/how-to-build-your-own-real-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question