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

Using dependency injection to replace a default behavior


SignalR's dependency injection system has been exploited so far to hook into the factory pipeline implemented to create instances of any Hub-derived type, but what's even more interesting about the whole usage of this system is the fact that most of SignalR's internals are exposed through the same mechanism. This means that you can actually replace entire portions of the SignalR machinery. Maybe you know a better way to perform their task, or maybe you just need to add some more features to a specific part, whatever the reason you can do it as we'll see here.

SignalR is organized in services, and all of them have a default implementation available. Let's list a few of them to just give you an idea:

  • IMessageBus: A service implementing this contract processes every single message, sent or received, with the goal of making them available to every subscriber; we already mentioned this interface when explaining how backplanes are implemented...