Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

How do FaceBook updates work?

Options
  • 09-12-2011 12:05am
    #1
    Closed Accounts Posts: 159 ✭✭


    How do FaceBook updates work?

    When browsing the FB homepage. Updates appear dynamically, you get the text blocks refreshing and the status updating. How is this happening if no http request was sent?


Comments

  • Registered Users Posts: 3,078 ✭✭✭onemorechance


    AJAX.


  • Closed Accounts Posts: 159 ✭✭yenoah


    But that would still have to request data no? via the XmlHttpRequest object ?? Isnt AJAX just about updating parts of a page rather than an entire postback?

    So my question still remains. How does FB update the page dynamically without the user requesting the update?


  • Registered Users Posts: 2,024 ✭✭✭Colonel Panic


    At a guess, setTimeout or setInterval? It just looks dynamic, it's polling with javascript and some callback function.


  • Registered Users Posts: 3,078 ✭✭✭onemorechance


    yenoah wrote: »
    But that would still have to request data no? via the XmlHttpRequest object ?? Isnt AJAX just about updating parts of a page rather than an entire postback?

    So my question still remains. How does FB update the page dynamically without the user requesting the update?

    BigPipe or facebook Ajaxified


  • Registered Users Posts: 11,980 ✭✭✭✭Giblet



    BigPipe is batching flush requests, it's possible to do that in any modern web framework, although it can be a pain in the arse! (Try it, turn off buffered output in .net, then turn it on before you render large controls, then off again after you flush.)

    Basically they have a timer on the page which runs at a set interval to check for updates.


  • Advertisement
  • Closed Accounts Posts: 159 ✭✭yenoah



    Can't see it. Having read the BigPipe article, all I can deduce is that it is used to divide a page into sections, each section can do server round trips in parrallel. Nothing about dynamic updates. Glanced over the Ajazified page and can't see anything about dynamic updates either.

    I see Gilbert has posted that a page runs a timer that checks for updates regularly. If that's the case then that makes sense but I'd love to hear from anyone else who might confirm or deny.


  • Registered Users Posts: 11,980 ✭✭✭✭Giblet


    Use firebug for firefox, or dev tools for chrome and all will be revealed ;)


  • Closed Accounts Posts: 159 ✭✭yenoah


    Giblet wrote: »
    Use firebug for firefox, or dev tools for chrome and all will be revealed ;)

    so you are saying that Facebook updates are browser specific? whhat about IE?


  • Registered Users Posts: 2,024 ✭✭✭Colonel Panic


    What's to confirm or deny? That's pretty much how it's done. Look at the source yourself!

    Anyway, I put breakpoints on the Timer event listeners in the Chrome Dev Tools and indeed it breaks a LOT.

    184466.png


  • Closed Accounts Posts: 159 ✭✭yenoah


    Thanks Gilbert and Colonel Panic.

    So the answer is a javascript timer looping in the client. Does that make FB hard on resources? memory? bandwidth?


  • Advertisement
  • Registered Users Posts: 2,024 ✭✭✭Colonel Panic


    In a modern browser, not especially.


  • Registered Users Posts: 11,980 ✭✭✭✭Giblet


    It's not an especially tight loop, so it's not terrible. It makes the state a little hard to determine though, and page integrity can fall apart in some cases.


  • Registered Users Posts: 1,311 ✭✭✭Procasinator


    Have a look at:
    http://www.facebook.com/note.php?note_id=14218138919

    This can be done though various techniques, Wikipedia gives a good overview:
    http://en.wikipedia.org/wiki/Push_technology

    I would hazard a guess though that most people use either traditional polling or long polling.


  • Registered Users Posts: 3,078 ✭✭✭onemorechance


    yenoah wrote: »
    Thanks Gilbert and Colonel Panic.

    So the answer is a javascript timer looping in the client. Does that make FB hard on resources? memory? bandwidth?

    Your question was how, not when.

    "How is this happening if no http request was sent?"

    An HTTP request is sent. The timer dictates when updates are requested; an XMLHttpRequest is how they are requested. This forms part of the AJAX web development technique, which is how "updates appear dynamically".


  • Closed Accounts Posts: 159 ✭✭yenoah


    Your question was how, not when.

    "How is this happening if no http request was sent?"

    An HTTP request is sent. The timer dictates when updates are requested; an XMLHttpRequest is how they are requested. This forms part of the AJAX web development technique, which is how "updates appear dynamically".

    eh? have we not already sorthed this?

    Requests for updates are sent by a timer in the client. Yes?


  • Registered Users Posts: 3,078 ✭✭✭onemorechance


    yenoah wrote: »
    eh? have we not already sorthed this?

    Requests for updates are sent by a timer in the client. Yes?

    No, they are sent by XmlHttpRequest.


  • Closed Accounts Posts: 159 ✭✭yenoah


    No, they are sent by XmlHttpRequest.


    yea, that's assumed. But I was wondering how the requests were triggered. Answer = timer loop.


  • Registered Users Posts: 3,078 ✭✭✭onemorechance


    yenoah wrote: »
    How is this happening if no http request was sent?
    yenoah wrote: »
    yea, that's assumed. But I was wondering how the requests were triggered. Answer = timer loop.

    OK, I assumed from your first post it was not.


  • Closed Accounts Posts: 2,616 ✭✭✭8k2q1gfcz9s5d4


    yenoah wrote: »
    Nothing about dynamic updates

    pretty sure FB doesnt have dynamic updates, it just updates every 60 seconds or so.


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    yenoah wrote: »
    Nothing about dynamic updates

    pretty sure FB doesnt have dynamic updates, it just updates every 60 seconds or so.

    That is dynamic updating.


  • Advertisement
  • Registered Users Posts: 11,980 ✭✭✭✭Giblet


    Probably means dynamic as in proper pushing rather than static interval


Advertisement