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 4 of 4

Thread: Polling

  1. #1
    New Coder
    Join Date
    Mar 2008
    Posts
    92
    Thanks
    19
    Thanked 0 Times in 0 Posts

    Polling

    Hi,

    I need to use ajax polling to update a page as soon as a value in the mysql database is changed. The polling will only happen on one page of the website and only like 1-10 people have access to the page at a time. Ideally, the ajax would call the php function every second, but does that strain the server any? I could live with like 20-30 second intervals if needed. Also, I read an article on long polling (comet) vs. regular. Does my situation call for long or regular? Regular seems easy to set up with jQuery.

    Thanks

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,296
    Thanks
    10
    Thanked 584 Times in 565 Posts
    comet is still very complicated to implement.


    if you can build a static page everytime the db is updated, it will be far easier on your server. you can use simple HEAD requests to espablish when the data changed, saving the download of a file every second. heads usually bounce back in one packet.

    you can run head every 5 seconds, and immed DL if the data changed.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #3
    Regular Coder ohgod's Avatar
    Join Date
    Jun 2008
    Location
    Ohio
    Posts
    579
    Thanks
    6
    Thanked 69 Times in 69 Posts
    http://www.prototypejs.org/api/ajax/periodicalUpdater

    super easy to set up and configure and even has an optional decay feature built in.

  • #4
    New Coder
    Join Date
    Mar 2008
    Posts
    92
    Thanks
    19
    Thanked 0 Times in 0 Posts
    Thanks, I guess I'll use like a 10 second interval. Also, I life jquery more than prototype, so I'm going to search for one of those plugins.


    Thanks


  •  

    Posting Permissions

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