Summary

In this chapter, we looked into Socket.io and WebSockets to enable two-way communication between the server and client. We worked on setting up a basic Express server, a backend and a frontend, and we committed it up on GitHub and on Heroku. Next, we looked into adding socket.io to the app to set up communication between the server and client.

Then, we looked into emitting and listening to custom events inside our application. Lastly, we wired up the message system by broadcasting the events such that when one user sends a message to the server, it actually gets sent to every connected user excluding the user who sends the message.

With all this in place, we now have a rudimentary—but working—messaging system, which is a great place ...

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.