title: long polling in objective-C
body: <p>I have an application that uses an API to get real time updates on the website. They use what they call a <a href="http://en.wikipedia.org/wiki/Push_technology#Long_polling">long-polling technique</a>: </p>
  
  <blockquote>
    <p>Long polling is a variation of the
    traditional polling technique and
    allows emulation of an information
    push from a server to a client. With
    long polling, the client requests
    information from the server in a
    similar way to a normal poll. However,
    if the server does not have any
    information available for the client,
    instead of sending an empty response,
    the server holds the request and waits
    for some information to be available.
    Once the information becomes available
    (or after a suitable timeout), a
    complete response is sent to the
    client. The client will normally then
    immediately re-request information
    from the server, so that the server
    will almost always have an available
    waiting request that it can use to
    deliver data in response to an event.
    In a web/AJAX context, long polling is
    also known as Comet programming.</p>
    
    <p>Long polling is itself not a push
    technology, but can be used under
    circumstances where a real push is not
    possible.</p>
  </blockquote>
  
  <p>Basically this enforces to make a request back to the server once you've got a response back. What is the best way to do this in an iphone application? This eventually has to run in the background.</p>