Chapter 14. Building Node.js clients and servers
This chapter covers
- Building Node.js RPC clients and servers with Apache Thrift
- Building HTTP[S] clients with Node.js
- Using Q with RPC clients
- Multiplexing multiple services over a single connection
In the following pages, we focus on the Node.js implementation of Apache Thrift, examining basic Node.js client and server operations and working our way through most of the Node.js-specific Apache Thrift features. Complementary to this chapter is chapter 15, “Apache Thrift and the JavaScript,” which explores browser-based JavaScript clients and using Node.js for building Apache Thrift web servers.
Each chapter in part 3 of this book begins by creating the same simple “Hello World” service. In this section, we’ll recreate the hello client and server using Node.js: each is, of course, interoperable with the “hello” clients and servers created in other languages.
HTTP is a valuable and well-understood transport, integrating with security features such as SSL/TLS as well as a range of header protocols offering authentication, network optimizations, and other benefits. On the downside, HTTP adds material overhead not always necessary in an RPC scenario. In this chapter, we’ll use native TCP for optimum performance, allowing chapter 15 to cover the features and benefits of Apache Thrift over HTTP.