Book Image

SignalR Real-time Application Cookbook

By : Roberto Vespa
Book Image

SignalR Real-time Application Cookbook

By: Roberto Vespa

Overview of this book

Table of Contents (18 chapters)
SignalR Real-time Application Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Implementing a room-based chat application


One of the most common types of real-time application is messaging systems, and chat applications are a good example of such a category. In this recipe, we will build a web chat where users will log in using a nickname, and once logged in, they will be able to create and join rooms. After joining a room, they will be able to post messages and see what other users say. The application will, of course, miss many of the functionalities that we usually find in a chat application, but it should be good enough to showcase a concrete usage of several SignalR features, namely the following:

  • Calling methods on a hub from the client

  • Triggering client-side callbacks from the server

  • Using the Groups API

Getting ready

Our application will consist of the following:

  • A Hub called ChatHub, which will handle things such as the login process, rooms management, and message broadcasting.

  • A page for the client part, named index.html, that displays the list of available rooms...