O'Reilly logo

OpenShift Cookbook by Shekhar Gulati

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with Web Sockets

HTTP was designed to be half-duplex, which means it allows transmission of data in just one direction at a time. This makes it unsuitable for building real-time applications that need an open, persistent connection always. To overcome this limitation of HTTP, developers have created some workarounds or hacks. Some of these workarounds are polling, long polling, and streaming.

Web Sockets provide an asynchronous, bidirectional, full-duplex messaging implementation over a single TCP connection. In this recipe, you will learn how you can use Socket.IO and Express to create a simple echo application. The application simply reverses the message and echoes it back to the user browser.

Getting ready

To complete this recipe, you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required