Chapter 6. Fallbacks: Data Push for Everyone Else

What we are going to look at in this chapter is a fallback approach, called long-polling, that (with a few tweaks) works just about everywhere. If the data being pushed is relatively infrequent, its inefficiency won’t even be noticed and you could get away with using it everywhere, but generally we will just use it for browsers where there is no native SSE support.

In both this and the next chapter I will start by showing the code in a minimal example. Then, after that, the FX demo from the end of Chapter 5 will be adapted to work with long poll. By the end of this chapter we will have 99% coverage (albeit with varying levels of inefficiency) for our production-quality, realistic, data push application.

Browser Wars

The differences between browsers (aka “The Browser Wars”) have been annoying us since the mid-1990s, but they became especially troublesome when Microsoft threw its hat into the ring and we went through a phase where each browser manufacturer tried to make the Web better, unilaterally, attempting to differentiate its product with features. That wasn’t what either the end users (you and me) or the content developers (again, you and me) wanted. Standards got discussed and ignored; it is only in the past few years that all the browser manufacturers have started taking standards seriously. The browser manufacturers finally realized they should differentiate themselves on user interface and speed, not proprietary features.

But ...

Get Data Push Apps with HTML5 SSE now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.