Communication between the client and server

Now, the communication could be anything at all. In this case, it comes in the form of an event. Events can be emitted from both the client and the server, and both the client and the server can listen for events. Let's talk about an event that might happen in an email app.

In an email app, the server might emit an event called newEmail when a new email comes in. The client is then going to listen for that event. When it fires, it will get the newEmail data and render the email to the screen below the other ones. The same thing could happen the other way: maybe the client wants to create a new email and send it to someone else. It will ask for the email address of the person and the contents of ...

Get Advanced Node.js Development 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.