Answer the question
In order to leave comments, you need to log in
How does socket.io work on android?
Как работает socket.io на андроиде? Ну т.е. что происходит, когда я запускаю соединени?Socket socket = IO.socket(socketAddress);
Запускается ли какой то встроенный в библиотеку сервис? или просто какой-нибудь поток?
Задаюсь этим вопросом потому как интересует поведение соединения при сворачивании приложения. Оно обрывается? Получает ли оно сообщения? Где вообще в общем можно почитать про весь скрытый функционал и логику работы socket.io на android?
Answer the question
In order to leave comments, you need to log in
The socket connection will terminate when your application is killed by the system. The socket itself cannot prevent this killing, you need to implement it yourself. Google towards Android Service and startForeground (if you want the service to run all the time).
PS Using a socket in applications for mobile devices is not really the best solution. Being connected all the time can cause an increase in battery consumption, which in turn will cause sidelong glances from users. As a replacement, the same GCM (or Firebase, as Google recommends) may work well.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question