Let's now enter a different territory, where we'll learn how to fully integrate our code with the internal behaviors of SignalR. SignalR offers a powerful way to extend its functionalities through a dependency injection API and strategy. Thanks to that, we can easily hook into the Hub creation process, and consequently we have a way to inject other objects into it and make them available to its methods.
In this recipe, we'll illustrate how we can transparently inject a specific reusable logic inside a Hub when it's created. The Hub will expose a simple method receiving a string and returning a corresponding translation obtained from a translator service injected at its creation.