O'Reilly logo

SignalR Real-time Application Cookbook by Roberto Vespa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling errors

In this last recipe of the chapter, we want to achieve a smarter exception-handling strategy, and for that we apply some of the lessons we learned about the extensibility features of SignalR, along with some other features specific of error management.

Getting ready

For this recipe, we'll use a new empty web application, which we'll call Recipe46.

How to do it…

Our code will contain a Hub with a couple of methods raising exceptions, and the following steps will illustrate how to work around them in order to collect and manage information about the errors:

  1. We create a new Hub called FailingHub using the SignalR Hub Class (v2) template. The following is what it should look like:
    using System; using Microsoft.AspNet.SignalR; using Microsoft.AspNet.SignalR.Hubs; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required