Chapter 9. Pushing Notifications with WebSockets

In this chapter, you’ll learn how to make applications more interactive by adding WebSockets. WebSockets allow you to push live changes from a server into a browser.

Introducing WebSockets

In the interest of finding ways to develop more interactive, more immersive applications, browsers now support a new protocol in addition to HTTP: WebSockets. HTTP was pretty much the only way for developers to communicate with browsers for a long time. It’s a reliable, relatively quick protocol that developers got by with.

The major downside to HTTP is that it’s one-way for web applications. The browser cannot be an HTTP server, which means that the client must initiate any communication. This works well for ...

Get Write Modern Web Apps with the MEAN Stack: Mongo, Express, AngularJS, and Node.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.