Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Sync countdown timer with Server from Android Application

A Countdown Timer is started from Node.js Server, and when starting a countdown timer a socket event(with countdown ~20s) is broadcasted to all connected clients(Android App) using Socket.IO.

And sometimes due to slow internet connection or due to some other reason, some clients receive the broadcasted message delayed and the countdown timer starts delayed in those devices. The countdown timer in server and the android app are not synced.

What should I do to sync the countdown timer with server from Android App?

like image 388
Valamburi M Avatar asked Oct 18 '22 22:10

Valamburi M


1 Answers

Instead of passing Countdown time you should pass expire time value and you have to get countdown time by your self. In this way your countdown time will be same on the server and mobile.

like image 117
VikasGoyal Avatar answered Nov 15 '22 07:11

VikasGoyal