Wrapping Up

This chapter explored how to write socket-based networked applications in Node. We developed both ends of a server/client interaction and created a JSON-based protocol for them to communicate.

When our assumptions about the protocol began to fail us, we developed a test case to expose the problem. We saw how to write a custom Node module and how to extend Node core classes, including EventEmitter. We also learned one technique for buffering streamed data and incrementally scanning it for messages.

Writing simple networked applications in Node, like the ones in this chapter, doesn’t take very much code. With only a few lines, you can have a functioning server or client application.

However, writing robust applications is harder when ...

Get Node.js the Right Way 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.