A
A
Andrey Sedyshev2019-03-20 22:59:48
Android
Andrey Sedyshev, 2019-03-20 22:59:48

How does Telegram respond so quickly to reading a message?

There are two telegram clients running: one on the phone, the other on the desktop.
A message arrives, the phone starts playing a push notification sound.
I activate the desktop client window and the sound on the phone is instantly interrupted.
Where can I read how this is done?
Looks like magic!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
rPman, 2019-03-20
@ musikant777

I don't know how it's done in the telegram, it's quite possible that it's just a fast server, .. besides, even placing the server on the other side of the world will give a ping in 0.2 seconds, for human perception it's instant.
If you need even faster, it is possible to use a local network (for example, torrent clients use this), besides, you do not need to scan the network, clients know what ip address they have been given, just try to connect (at startup and periodically when changing network settings) using them and keep the connection, then the reaction will be instantaneous even by the standards of the machine (a couple of milliseconds).
ps Perhaps you were brought up on the brakes of the http rest architecture, where periodic polls are used for messaging instead of a constantly open tcp or even udp connection?

S
Stalker_RED, 2019-03-21
@Stalker_RED

Play counterstrike or q3, see how they instantly process dozens of events per second from a dozen clients.
On the technologies of the last millennium.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question