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

Managing errors across a complex asynchronous workflow


In this last recipe, we'll introduce one last concept to have a full view of the basic features made available by the JavaScript Hubs API: how to react to errors that occur during all the possible SignalR operational steps and states.

For some specific cases, SignalR offers a couple of native ways to deal with errors as follows:

  • We can supply a fail() callback to any JavaScript promise object that SignalR returns. This means that we can either use fail() on the promise object returned when starting a connection to intercept errors during the connection process, or we can use fail() on the promise object returned during the remote invocation of a Hub method. By hooking a callback with these fail() methods, we can be notified about the exceptions that occur during either the networking portion of a remote invocation or the server-side execution of a Hub method. We should observe that for errors occurring because of networking issues, SignalR...