S
S
Saint7392020-11-26 09:45:06
Android
Saint739, 2020-11-26 09:45:06

Chat for android falls asleep and breaks websocket. How to leave the chat online when the phone falls asleep?

There is a web application, chat. Works great via websocket on a PC (browser, application on nw.js). When trying to transfer it to android, the websocket closes after about 5 minutes as the screen goes blank. Tried PWA and WebView.
So the question is how are chats for android implemented? Do they keep a constant connection to the messaging server? Or are they just subscribed to push notifications? And when you click on the push that a new message has arrived, the chat starts and a connection is made?
Or am I already writing nonsense? In fact, you need to see other users on the web and the status of the client on android (available, away, dnd). And with a broken websocket, the status is unavailable. Well and messages do not reach naturally. Some battery-saving functions have been invented, but telegram, whatsapp work. Give me direction please.
Of course, it would be desirable to leave all the main program functionality in javascript + HTML, so that you do not have to write a chat client from scratch.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-11-26
@Saint739

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question