Make sure your website or web application users get content updates right now with minimal latency. This concise guide shows you how to push new data from the server to clients with HTML5 Server-Sent Events (SSE), an exceptional technology that doesn’t require constant polling or user interaction. You’ll learn how to build a real-world SSE application from start to finish that solves a demanding domain problem.
Determine whether SSE, WebSockets, or data pull is best for your organization
Develop a working SSE application complete with backend and frontend solutions
Address error handling, system recovery, and other issues to make the application production-quality
Explore two fallback solutions for browsers that don’t support SSE
Tackle security issues, including authorization and "disallowed origin"
Develop realistic, repeatable data that’s useful in test-driven SSE design
Learn SSE protocol elements not covered in the example application
The animal on the cover of Data Push Apps with HTML5 SSE is a short-beaked echidna (Tachyglossus aculeatus). The four species of echidnas, along with the platypus, are the only mammals who lay eggs instead of giving birth to live young. The short-beaked echidna is found in forested areas of Australia (where it is the most widespread native mammal) and parts of New Guinea.
Short-beaked echidnas are 12–18 inches long, with brown fur and cream-colored spines (made of keratin) on their back. True to their name, their snouts are about 3 inches long, shorter than other echidna species. The leathery snout serves multiple purposes: its wedge shape is optimized to explore insect mounds, it has electroreceptors that help detect nearby prey, and its labyrinth-like bone structure is believed to help condense exhaled water vapor and cool the animal down (since echidnas do not have sweat glands).
Echidnas are sometimes called spiny anteaters, though this term has fallen out of use since they are not actually related to true anteaters. Their diet is indeed made up of insects, however—mostly ants and termites, which they catch by digging into the insects’ nests and capturing prey with their long sticky tongues. Echidnas are expert diggers, thanks to their specialized claws and strong short limbs. Apart from hunting prey, they also dig as a defense mechanism; if threatened, they will burrow very quickly into the ground and roll into a ball, leaving only their sharp spines exposed. They are also capable swimmers, which they do with only their nose above water, like a snorkel.
The short-beaked echidna appears on the reverse side of Australia’s 5-cent coin, and has even made it into videogames, as the character Knuckles in the classic Sonic the Hedgehog series.