Summary
In this chapter, you learned how to implement a simple monitor server that pushes data changes in real time to the client. We used Node.js because of its nonblocking I/O behavior and because of the fact that we can write the server code in JavaScript.
After installing Node.js and creating a package.json file for the application, we installed the express and serve-static web framework via the npm Node package manager.
We used the serve-static package to serve all the static files in the root directory of our application and added it as a middleware to express. This allows you to write a simple file server in less than 10 lines of code.
To implement real-time communication, we need a bidirectional connection rather than the unidirectional HTTP ...
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