Calling back the caller from a Hub's method
With this recipe, we are actually starting to look at more interesting and real-time SignalR features. We will see how a Hub can call back into a client that just performed a remote method call.
Getting ready
Before starting with this recipe, we need to create a new empty web application, which we'll call Recipe06
.
How to do it…
Let's start building the server-side portion of this recipe using the following steps:
- We must first add a Hub called
EchoHub
. - We must then add an OWIN Startup class named
Startup
, containing just a simpleapp.MapSignalR();
bootstrap call inside theConfiguration()
method. - Let's make the Hub's content look like the following:
using System; using Microsoft.AspNet.SignalR; using Microsoft.AspNet.SignalR.Hubs; ...
Get SignalR Real-time Application Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.