Those who are not sure of what a penny auction system is, you’re encouraged to visit
dealdash.com . I’m trying to build the prototype of the core part (bidding on a product) of this app. My development strategy is create a product with its
I should be able to start an auction from server by
Lets assume the bid duration will be for
30 seconds so,
expire_time will be
start_time+30 sec when I create a product.
The approach i’ve been considering is to update the
current_server_time+30 sec field of the MongoDB whenever an user clicks/bid.
And I feel there are two ways to display the countdown timer in the client.
- Observing the difference of
expire_time. which leads to knocking the database every second. which is kind of inefficient.
- running a countdown timer offline and only update the database whenever an user bid. and observing only the
expire_time. If it changes , the countdown timer reset with 30 second.
I’m currently trying achieve the second one. I’ve modified an existing countdown timer collected from internet. let’s assume the method is
this method can run a countdown timer logging into the console. The problem is variables of this methods are not reactive. I can solve this by putting the
second value in the session and using a helper.
But I find some difficulties here and looking for ideas from you.
- when a user visit the site , he should be able to see the timer also. how do I handle that? If I try to count the number of products are in auction right now in the
Meteor.isClientby a query , it’s returning me 0 as for the first time the
Any better solutions/ideas/suggestions are mostly welcome.
AS this post is quite large, you might get confused/lost. you are requested to knock me for any clarification.