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
About the Author
About the Reviewers

Implementing a shared whiteboard

Our next example of a real-time application is a shared whiteboard. SignalR is definitely a good platform to build real-time collaborative tools, because its ability to push information to the clients makes managing a shared status easy, allowing us to keep it synchronized across several instances of the same gadget. Our whiteboard will allow users to join it and draw simple rectangles, which will be broadcasted live to all users. It will also allow us to store them on the server to keep a live history that will be used to generate the current status of the whiteboard to be pushed to new users when they connect. To build these capabilities, we'll use the following SignalR features:

  • Calling methods on a hub from the client

  • Triggering client-side callbacks from the server

  • Using the Groups API

  • Using the state bag

  • Handling server-side errors

Getting ready

Our application will consist of the following:

  • A Hub called WhiteboardHub, which will be used to handle the login...