Let's Chat web app – high-level design

In this section, we will look at the flowchart that we created and we will come up with granular modules to constitute the app using ASP.NET Core 2.0. We need to develop the following:

  • An authentication and authorization module that takes care of login and authentication of users
  • A registration module that takes care of user registration
  • A chat room page
  • A module that keeps track of all the logged in users and notifies the client chat room pages about the user joining and leaving
  • A user information module that keeps track of all the user information, such as display name, display picture, and so on
  • A chat hub module that enables a message to be broadcast from each user to the other online users

Sounds easy? Let's see how we can design and implement each of the preceding requirements using ASP.NET Core 2.0:

  • Authentication and authorization module: This is a core functionality and needed in most modern apps. It makes sense to use something that is already developed, tested, and secure, so that we do not waste our time and energy in rediscovering the wheel. There are a variety of ways by which we can achieve this, such as by creating and using a custom identity provider, or using Facebook, Twitter, Google, or Microsoft authentication providers. We will use Facebook authentication in our app, as it's more likely for the user to have a profile picture in Facebook, which would give a good user experience while chatting. This is done through OAuth (pronounced oh-auth), which stands for open authorization and is an open standard for token-based authentication and authorization on the internet. We will discuss this in detail when we implement it in our app. This will take care of Steps 1 through 5 in our flowchart discussed in the previous section.
  • Chat hub module: This module will be responsible for enabling real-time chat between all online users and will also track the users as they join and leave the room. The hub will receive messages from clients and then broadcast the received messages to all clients. This will be an implementation on top of the SignalR hub and will be responsible for handling user connections, disconnections, and all the real-time messaging functionality. We have already seen and coded the basics of SignalR in our last app.

Now that we have high-level designs in place, let's deep dive into the details to implement these and learn more about them.

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

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