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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access