left-icon

Real-Time ASP.NET Core 3 Apps with SignalR Succinctly®
by Dirk Strauss

Previous
Chapter

of
A
A
A

CHAPTER 7

Running the Application

Running the Application


You have now completed all the code needed for your real-time chat application. Run your application in Visual Studio by pressing Ctrl+F5, or if you are using Visual Studio for Mac, select Run > Start Without Debugging. If you are using Visual Studio Code, type the following command in the integrated terminal.

Code Listing 14

dotnet watch run -p realtimechat.csproj

Once your application starts in your browser, copy the URL, open another instance of the browser, and paste the URL in the address bar.

Enter your username and type a message, as illustrated in Figure 26. Select Send Message.

Browser 1 Message

Figure 26: Browser 1 Message

When you click the Send Message button, the message is immediately displayed in the list at the bottom of the browser page on browser 1. If you look at browser 2, illustrated in Figure 27, you will see the same message displayed in that browser.

Browser 2 Message Received

Figure 27: Browser 2 Message Received

In browser 2, add the username Mark, type a reply for John in the Message field, and select Send Message.

Browser 2 Reply

Figure 28: Browser 2 Reply

As seen in Figure 28, the reply is displayed in the list, and on browser 1 (John’s browser), as seen in Figure 29.

Browser 1 Reply from Mark Received

Figure 29: Browser 1 Reply from Mark Received

Messages from other users are green, while messages that you type are blue. This logic is contained in the chat.js file that adds a class to the <li> element based on the current username.

Scroll To Top
Disclaimer
DISCLAIMER: Web reader is currently in beta. Please report any issues through our support system. PDF and Kindle format files are also available for download.

Previous

Next



You are one step away from downloading ebooks from the Succinctly® series premier collection!
A confirmation has been sent to your email address. Please check and confirm your email subscription to complete the download.