Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: Auction site

  1. #1
    New Coder
    Join Date
    Nov 2009
    Posts
    59
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Auction site

    Hi!
    I'm working on an auction site.The problem is,that when someone takes an offer,i update the DB column,then i should change the current offer in everybody's browser.I don't see other way,than sending an AJAX request from the script in every 1 second to the DB,selecting the price then displaying it again.But this looks a very bad solution.
    Anybody has any other idea?

  • #2
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    822
    Thanks
    93
    Thanked 18 Times in 18 Posts
    Server sent events might be an option you could take.

    http://www.html5rocks.com/en/tutoria...source/basics/

  • Users who have thanked tomharto for this post:

    tangoforce (05-17-2013)

  • #3
    New Coder
    Join Date
    Nov 2009
    Posts
    59
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tomharto View Post
    Server sent events might be an option you could take.

    http://www.html5rocks.com/en/tutoria...source/basics/
    Thx for the answer,but i checked it out,and IE doesn't supports this method.

  • #4
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    822
    Thanks
    93
    Thanked 18 Times in 18 Posts
    I'm not sure, apart from like you say running AJAX, maybe just run it every minute or when a user goes to enter a bid?

  • #5
    New Coder
    Join Date
    Nov 2009
    Posts
    59
    Thanks
    9
    Thanked 0 Times in 0 Posts
    The problem is that i can send an AJAX request from the actual bidder's browser,but the more visitor,whom has their browser open,hence they have an old copy of the site,won't see any change until they don't get new data from the server by explicitly requesting it.Or i use AJAX to send the request in every second or so,to keep them updated.
    I tested this,works fine in FF,Chrome,but in IE "Sorry, your browser does not support server-sent events...":
    http://www.w3schools.com/html/tryit....e=tryhtml5_sse

  • #6
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    822
    Thanks
    93
    Thanked 18 Times in 18 Posts
    You could use SSE for FF and Chrome etc, and use AJAX in IE but recommend people use another browser? Apart from that the only thing I can think to suggest is use AJAX requests every few second for all browsers.

  • #7
    New Coder
    Join Date
    Nov 2009
    Posts
    59
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Thank you,in the afternoon i got to the same decision.Then a problem again:in Chrome SSE is accepted,i see the change in the source code,but nothing displays.First time in my life i can say that there is a browser that -in this particular case- more annoying then IE Anyway,i stick with AJAX,i'll ask the sysadmin how many requests can we handle/second,then i'll choose an acceptable interval for sending the requests.I checked a few sites,i think 10 seconds'll be good.
    Have a nice day!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •