how to synchronize countdown timer to all user - angularjs

I am developing a countdown timer app. User can register the app and share their own countdown timer; However, I have a problem here, how to let all user synchronize the same countdown timer?
I use Angular and NodeJS + MongoDB to develop this app.
My problem is the countdown timer is running by angularjs that only one user can see the running timer, but other people can't. Should I update every second number in database and query it every second or running timer in the backend?
any suggestion ?

I'd do it this way: When the timable action occurs server-side, store both the start time and the end time in the database. Upon page load, both numbers get pulled to the client, which figures out the delta and starts its own local countdown. The GUI can optionally show the server-side end time, which is the "time of record."

Related

How to handle hide ui from user when package expire

i am working on one reactjs project - where i need to check after every 30 minutes if user have a subscription plan then show ui otherwise hide- The subscription plan details is stored in the local storage.I don't want to use any low level function like use setInterval. Please suggest some optimzed answer.

Tracking performance in a SPA

We are rebuilding an existing JSP web application using AngularJS. In our existing application we use the page load time metrics extensively.
With the SPA there are no real page load times. How can we track user experience of performance through GA in this scenario?
If you want to know how long something takes you can use User Timings - this somewhat resembles event tracking, only you pass a duration as value parameter (i.e. you need to start a timer when your thing starts, stop if when it's ready and the time measured is the value for the user timing):
ga('send', {
hitType: 'timing',
timingCategory: 'SPA Content change',
timingVar: 'load',
timingValue: 100
});

Is it appropriate to create a stop watch web app based on firebase?

Is it appropriate to create a stop watch web app based on firebase?
Actually what I want to know is that :
whenever the stop watch's time change every second ,
is it appropriate to update the changed time into firebase DB every second?

how to change apache camel timer polling period dynamically

Hi I am using apache camel timer component in my route. I need to change the period polling interval dynamically. I have a business method which will return some time interval and it will be different depending on logic. I have to pass this to Timer so that my timer should poll according to this interval. I don't want to start and stop the route with new interval as its performance hit.
I want one timer route for which period has to be set dynamically.
The timer cannot be changed at runtime, as its using the JDK java.util.Timer which cannot be changed.
You can use camel-quartz which allows changing the scheduler at runtime, which you can do using JMX. There is also a Quartz plugin in hawtio - http://hawt.io/plugins/quartz/ - that allows you to change the scheduler using a web UI.

Page does not self refresh after task in Taskqueue is done updating values

So I had a problem with a task in a worker's POST command taking way too long and was getting DeadlineExceededErrors. I started using Taskqueues and that part works great now- no more Deadline errors. The problem now is that my main page "refreshes" (self.redirect) before the task queue is done so the new detail is not shown automatically and the user has to press refresh themselves, which is a hassle. Do you have any recommendations as to the easiest way to fix this problem? A high level overview of my app is as follows:
1) Main Handler has Get and Post - Get writes a html page which shows new values after the task in the queue has completed. It also has a form which submits queries to its Post section.
The Post section adds the task onto the taskqueue and then calls self.redirect back to the main html page.
2) The Main Worker has a Post command - this is what is added into the queue. It takes about 1-2 minutes to run and then updates a ndb.Model element with new values.
Back in the Main Handler Get function the ndb.Model element has its .query() function called to return the new values.
Any help or advice would be appreciated. Thanks!
A task that takes 1-2 minutes to execute is not suitable for user interaction: users are not used to wait that long. Typically, there are three options to resolve this:
(a) Offer a refresh button.
(b) Start a timer that periodically checks if a task is complete. This timer updates the page when a task is finished and stops. Remember that a user may leave the page which started the task.
(c) Deliver the result of a task in a different way (email or push notification).
If your user is willing to wait that long, you could serve these requests in a custom module, which does not have the time limitation. See Modules in GAE docs.

Resources