9 ms·
iOS6 breaks long polling
- mh- 14y agodefinitely a bug. most browsers, going back a decade, support 4-8+ concurrent connections to a given host (hostname, really).
- saurik 14y agoSomeone at Apple is going "we have had iOS 6 in beta for months now; is this really the first time anyone noticed this issue?".
- dvhh 14y agoNot every web developper is a iOS developper.
- saurik 14y agoHowever, I would be highly surprised if none of them were ;P, and this is the kind of issue that seems like it should have affected almost everyone building anything; hell: I would have noticed and filed this bug had I still been working on the web project I was working on last year around this time. It is thereby highly surprising that no one noticed this.
- bmeckel 14y agoSeriously this is a huge oversight. The only thing that comes to mind is that the web-app developers (understandably) didn't see the need to test on iOS 6 but I can't imagine there was absolutely no overlap.
- deleted 14y ago[deleted]
- saurik 14y agoYour attempt at sarcasm seems to rely on me saying those people were assholes, when I did not: I would hope you would agree with me that it is highly surprising that no one would have noticed this issue in months of testing; this is indicative of a failure somewhere else, such as 1) last-minute changes, 2) internal routing of communication, 3) closed developer ecosystem, etc.; no matter what the cause, someone at Apple is having that reaction, and I'd love to have been around to see what the resulting discussion and possible outcomes of that question were.
- ricardobeat 14y agoThat's the first thing that came to my mind. WTH?
- pkulak 14y agoHow many web apps do long polling? I doubt it's many.
- Joeri 14y agoMost web developers use a windows or linux machine to develop and a physical device to test (myself included). That combination prevents you from running the iOS 6 beta, because you need a mac for that. So, only a minority of web developers (those with access to a mac) actually could have tested the iOS 6 beta. Additionally, the first iOS 6 betas had the browser in such a bad shape that it was obvious they were still working on it. I took one look at it and figured "i'll test it when they're done". They need to have some sort of clear indication of when it's actually ready for testing (and not just for testing of the native SDK's).
- taligent 14y ago>Most web developers use a windows or linux machine to develop and a physical device to test. Maybe I am living in a bubble but every single web developer I have ever met used a Mac. Why ? Because it is the only platform that has Photoshop + a UNIX shell.
- buddydvd 14y agoAnother connection related issue is that iOS 6 cache responses of ajax POST requests. http://news.ycombinator.com/item?id=4550441 http://news.ycombinator.com/item?id=4550441
- skeletonjelly 14y agoOuch. That could cause some real damage!
- steve8918 14y agoI submitted that post, so I have some vested interest in this. I came across this bug because I was converting one of my web apps to use the new iOS 6 feature of being able to upload photos from your Camera Roll to a web site. However, when you upload a picture, apparently, they are all called image.jpg. Since the image name never changed, every time I uploaded a new pic, the first pic was being returned. I couldn't understand why, and as usual, stackoverflow had a good answer for me. I needed to add a timestamp option to my URL in order to work around this behavior.
- username 14y agoTime to break out the gifsockets. https://github.com/videlalvaro/gifsockets https://github.com/videlalvaro/gifsockets
- halter73 14y agoFunny, but a one connection at a time restriction would break gifsockets just like long polling.
- old_sound 14y agoDude, the gifsockets example "uses one connection at a time" because I'm too lazy to implement a server using Netty or Aleph in Clojure. The only important part from the gifsockets concept is writing gif frames on demand. The rest is up to you
- shawnz 14y agogifsockets is just a niche implementation of long polling. They work the same way.
- Mythbusters 14y agoQuality control is for the wimps
- dudus 14y agoHe claims that it doesn't happen on Chrome for iOS. But isn't chrome for iOS just a "skin" with new features on top of the same safari browser? One issue like I would expect to affect Chrome as well.
- tdrd 14y agoChrome on iOS uses safari's layout engine (because Apple doesn't allow dynamic code generation) but the network stack is Chrome's.
- mintplant 14y agoWell, it's known that UIWebView and Safari have their own differences between them; for example, the slower JavaScript engine in the former. I would guess that this would be one of them.
- codeka 14y agoThis is very strange... If the browser only opens one connection to a domain at once, it should have made so many sites much slower to load and it's hard to believe Apple don't have automated tests to check for performance regressions like that.
- bathat 14y ago> ... it's hard to believe Apple don't have automated tests to check for performance regressions like that. Well, I mean, this is the same company that has received "some press" recently regarding the latest version of its mapping application. Edit: That was a low blow, wasn't it?
- garindra 14y agoI might be wrong here, but if you're using long polling in your webapp, shouldn't you be using a randomized wildcard subdomain anyways? For example, Quora uses #.tch.quora.com as their long polling hostname, with the #-part randomized for each of the browser tab, which effectively allows for an unlimited number of concurrent connections to a single IP address. I mean, even though Chrome allows 6+ concurrent connections to a single hostname, nothing's stopping users from opening 10 tabs of your application.
- dwj 14y agoI think you might be wrong here :) I've no idea why Quora does that, but I'm pretty sure it's not a standard thing. You really should only being doing one long poll at a time, so it should never be an issue.
- pilif 14y agoI'm using long polling in our application and I don't see that one connection per server restriction here. I did however see that safari was not leaving the loading state (and thus not firing any of the loaded events, nor hiding the URL bar) if I started the long polling connection before the page was fully loaded. Once I moved opening the connection to a setTimeout callback inside the onLoad handler (so not DOM ready, but actual load), this went away and the page works normally.
- codeka 14y agoNow this makes sense. As I said below, it seems really strange that this would go unnoticed, especially since one-connection-per-domain affects all sites and not just ones doing long polling. Still a pretty bad bug, though.
- atotic 14y agoI believe the restriction is "only single keep-alive connection". This makes sense to me, no need for multiple overhead if one connection will saturate your bandwidth. It will open multiple if the server does not support keep-alive. Workaround is easy: make sure your long-polling connection is not keep-alive connection.
- dwj 14y agoThat doesn't seem like a sensible solution. You're basically hurting performance on all other platforms just to work around one of Apple's bugs.
- TazeTSchnitzel 14y agoWell, iOS 6 has websocket. Visit http://ajf.me/websocket http://ajf.me/websocket and see for yourself. Since everything will be moving to websocket eventually, might as well get a head start on iOS.
- kybernetikos 14y agoHeadstart over whaat? Even ie10 has it.
- TazeTSchnitzel 14y agoI mean, you still have to support IE6-9 in the meantime.
- pornel 14y agoUnfortunately, it won't solve the problem for all iOS users. For example the WebSocket protocol is blocked on most UK 3G networks (e.g. O2's censorship proxy only handles real HTTP traffic)
- TazeTSchnitzel 14y agoSurprised I haven't noticed. I'm on Tesco Mobile, which is really O2's network.
- the_mitsuhiko 14y agoJust encrypt the traffic.
- TazeTSchnitzel 14y agoYeah. wss: is a thing.
- laacz 14y agoI'm not sure, why should someone rely on long polling alone. Default fallback mechanism is websockets (supported on iOS), long polling (not supported anymore, obviously) and then follows separate ajax calls. It is not uncommon that something in this sequence would break by design, unsupportedness or bad data connection, so fallback should be used.
- MatthewPhillips 14y agoiOS supports Server Sent Events, which is what should be used in this type of situation: http://mobilehtml5.org/ http://mobilehtml5.org/
- bobfunk 14y agoI have a small hosted service in beta, making it dead easy to push events via Server Sent Events (with fallbacks). http://www.eventsourcehq.com/ http://www.eventsourcehq.com/ It's fully open source and can be self hosted as well: https://github.com/eshq/eventsource-broker https://github.com/eshq/eventsource-broker
- jevinskie 14y agoThank you for linking to that very informative page. The support matrix is interesting enough but even more interesting is that I didn't know about most of those APIs.