Long polling with NSURLConnection

前端 未结 5 1473
天涯浪人
天涯浪人 2020-12-31 06:46

I\'m working on an iPhone application which will use long-polling to send event notifications from the server to the client over HTTP. After opening a connection on the ser

5条回答
  •  孤独总比滥情好
    2020-12-31 07:29

    We're currently doing some R&D to port our StreamLink comet libraries to the iPhone.

    I have found that in the emulator you will start to get didReceiveData callbacks once 1KB of data is received. So you can send a junk 1KB block to start getting callbacks. It seems that on the device, however, this doesn't happen. In safari (on device) you need to send 2KB, but using NSURLConnection I too am getting no callbacks. Looks like I may have to take the same approach.

    I might also play with multipart-replace and some other more novel headers and mime types to see if it helps stimulate NSURLConnection.

提交回复
热议问题