Unit 7. Adding chat functionality

By this point, the main structure of your application is complete. It’s time to think about new features that could improve the overall interaction on your application but aren’t necessary for the fundamental functionalities. In earlier lessons, I discussed how particularly useful Node.js is for handling streams of data. If you want to send a big batch of data across the internet, Node.js makes the process simpler by supporting data chunking. Chunks of data are connected as they arrive at the server and processed when there’s enough data to do something meaningful with them. This approach is useful in various types of data streams, and it’s made possible through the event-emitting and event-handling features of Node.js.

In this unit, you explore how to use Node.js to facilitate a real-time chat application through event-driven communication over web sockets. I discuss how chat applications can be built with the simplest of HTML tools and how web sockets and socket.io are more-efficient, sophisticated options than historic client-server communication. You apply the chat functionality to your existing application to allow existing users to communicate in a group setting. Then you take things a step further by creating a data model for your chat messages and loading messages from the database when you open the application’s chat page. Last, you implement an icon in the navigation bar that acts as an indicator when the chat page is active, even when the user is on a different page.

This unit covers the following topics:

  • Lesson 30 introduces web sockets and shows how the socket.io package can help you connect users of your application through a real-time chat application. In this lesson, you learn how to create a simple chat page on your existing recipe application.
  • Lesson 31 shows you how to take your chat application to the next level by saving the messages to your MongoDB database. In this lesson, you create a message model and connect the message to the sender. This way, you’ll be able to identify which messages belong to the user who’s logged in.
  • Lesson 32 guides you through the implementation of an active chat indicator in the navigation bar. This icon animates as messages are shared on the chat page.

In lesson 33 (the capstone lesson), you use the concepts learned in this unit to build a chat feature for the Confetti Cuisine application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.68.14