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

Adding a client-side method on the proxy and calling it from the server


In our journey through the recipes from Chapter 3, Using the JavaScript Hubs Client API and their adaptation to the .NET client Hubs library, we have just arrived at the point where we have to modify the recipe that has a similar name, in which we saw how we can define a client-side method to be called directly from inside a remote Hub. The server that we built there is already calling back its caller; therefore, in this recipe, we'll just need to connect to it, call the Say() method, and wait for the callback to happen.

Getting ready

The following code will connect to the EchoHub exposed in the Adding a client-side method on the proxy and calling it from the server recipe from Chapter 3, Using the JavaScript Hubs Client API, which we have to run before testing this Recipe.

How to do it…

Let's create a console application project as described in the introduction, and let's name it Recipe23. The source code of the Program...