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

Establishing proxy-less connections


One of the biggest differences that we might have observed when comparing the .NET client library against the JavaScript one, is the presence of the dynamic proxies on the latter. SignalR takes advantage of the dynamic nature of the JavaScript language to generate proxies on the fly. Proxies greatly simplify both the calls towards the server-side Hub and the declaration of the callbacks that will be invoked from within any server-side Hub context, but the .NET client does not have this luxury. We have to resort to a calling strategy based on strings used to refer to the actual method names exposed by the Hub.

On the other hand, we have already highlighted during the Generating static files for JavaScript proxies recipe that the generation of dynamic proxies has its drawbacks, which we then solved by using the signalr.exe utility to create the proxies statically and persist them in a file to be referenced in our client pages. In this recipe, we illustrate...