SignalR Real-time Application Cookbook

Book description

Use SignalR to create real-time, bidirectional, and asynchronous applications based on standard web technologies

In Detail

SignalR is a recent addition to ASP.NET, which allows you to add real-time functionalities to your applications. SignalR enables bidirectional communication between client and server over HTTP, transparently, and ensures you're always provided with the experience of a persistent connection.

SignalR Real-time Application Cookbook is a practical, hands-on guide that provides a number of clear step-by-step recipes that will gradually enable you to add SignalR as an innovative, effective, and useful item in your toolbox. This book will move from simple examples on to complex use cases, going through a comprehensive overview of the library. Other than helping out with the common tasks, at the end of the book you will find a set of ready-made solutions for more complex scenarios.

What You Will Learn

  • Teach you how to build SignalR servers
  • Illustrate SignalR clients built with both the JavaScript and the .NET client libraries
  • Demonstrate both the Hubs API and the Persistent Connection API
  • Demystify the lifetime of a connection
  • Explain how to authorize requests
  • Scale up and scale out your SignalR applications
  • Enable you to handle errors efficiently
  • Extend SignalR with custom services
  • Solve complex real-time scenarios with the help of advanced, ready-made examples

Table of contents

  1. SignalR Real-time Application Cookbook
    1. Table of Contents
    2. SignalR Real-time Application Cookbook
    3. Credits
    4. About the Author
    5. Acknowledgments
    6. About the Reviewers
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    9. 1. Understanding the Basics
      1. Introduction
      2. Adding a Hub to an ASP.NET project
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      3. Adding a Hub to a self-hosting application
        1. Getting ready
        2. How to do it…
      4. Connecting to a Hub from a JavaScript client
        1. Getting ready
        2. How to do it…
        3. How it works…
      5. Connecting to a Hub from a .NET application
        1. Getting ready
        2. How to do it…
        3. How it works…
    10. 2. Using Hubs
      1. Introduction
      2. Adding a method to a Hub and counting the calls to it
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      3. Calling back the caller from a Hub's method
        1. Getting ready
        2. How to do it…
        3. How it works…
      4. Broadcasting to all connected clients
        1. Getting ready
        2. How to do it…
        3. How it works…
      5. Adding a connection to a group
        1. Getting ready
        2. How to do it…
        3. How it works…
      6. Removing a connection from a group
        1. Getting ready
        2. How to do it…
      7. Broadcasting to all connected clients except the caller
        1. Getting ready
        2. How to do it…
      8. Broadcasting to all clients except the specified ones
        1. Getting ready
        2. How to do it…
      9. Broadcasting to all clients in a group except the caller
        1. Getting ready
        2. How to do it…
      10. Broadcasting from outside a Hub
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      11. Using the return value of a Hub method
        1. Getting ready
        2. How to do it…
        3. There's more…
    11. 3. Using the JavaScript Hubs Client API
      1. Introduction
      2. Starting a Hub connection
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also…
      3. Setting up connection transport strategies
        1. Getting ready
        2. How to do it…
      4. Calling a server-side Hub method
        1. How to do it…
      5. Adding a client-side method on the proxy and calling it from the server
        1. How to do it…
      6. Managing errors across a complex asynchronous workflow
        1. How to do it…
        2. How it works…
        3. There's more…
    12. 4. Using the .NET Hubs Client API
      1. Introduction
      2. Starting a Hub connection
        1. Getting ready
        2. How to do it…
        3. How it works…
      3. Setting up connection transport strategies
        1. Getting ready
        2. How to do it…
      4. Calling a server-side Hub method
        1. Getting ready
        2. How to do it…
        3. How it works…
      5. Adding a client-side method on the proxy and calling it from the server
        1. Getting ready
        2. How to do it…
        3. How it works…
      6. Managing errors across a complex asynchronous workflow
        1. Getting ready
        2. How to do it…
        3. How it works…
    13. 5. Using a Persistent Connection
      1. Introduction
      2. Adding and registering a persistent connection
        1. Getting ready
        2. How to do it…
        3. How it works…
      3. Sending messages from the server
        1. Getting ready
        2. How to do it…
        3. How it works…
      4. Sending messages to the server
        1. Getting ready
        2. How to do it…
        3. How it works…
      5. Exchanging messages between a server and a JavaScript client
        1. Getting ready
        2. How to do it…
        3. How it works…
      6. Exchanging messages between a server and a .NET client
        1. Getting ready
        2. How to do it…
        3. How it works…
    14. 6. Handling Connections
      1. Introduction
      2. Controlling the lifetime of a connection
        1. Getting ready
        2. How to do it…
        3. How it works…
      3. Handling a connection transient state
        1. Getting ready
        2. How to do it…
      4. Establishing a cross-domain connection
        1. Getting ready
        2. How to do it…
        3. There's more…
    15. 7. Analyzing Advanced Scenarios
      1. Introduction
      2. Generating static files for JavaScript proxies
        1. Getting ready
        2. How to do it…
      3. Authorizing requests on a Hub
        1. Getting ready
        2. How to do it…
        3. There's more…
      4. Authorizing requests on a persistent connection
        1. Getting ready
        2. How to do it…
      5. Authorizing requests in a self-hosting context
        1. Getting ready
        2. How to do it...
      6. Scaling up
        1. How to do it...
        2. There's more…
      7. Scaling out with Azure
        1. Getting started
        2. How to do it...
        3. How it works...
      8. Scaling out with Redis
        1. Getting started
        2. How to do it...
      9. Scaling out with SQL Server
        1. Getting started
        2. How to do it...
      10. Establishing proxy-less connections
        1. Getting ready
        2. How to do it…
        3. How it works…
      11. Introducing dependency injection (simple approach)
        1. Getting ready
        2. How to do it…
        3. How it works…
      12. Introducing dependency injection (advanced approach)
        1. Getting ready
        2. How to do it…
      13. Using dependency injection to replace a default behavior
        1. Getting ready
        2. How to do it…
        3. How it works…
      14. Extending the Hub pipeline
        1. Getting ready
        2. How to do it…
        3. There's more…
      15. Handling errors
        1. Getting ready
        2. How to do it…
    16. 8. Building Complex Applications
      1. Introduction
      2. Implementing a room-based chat application
        1. Getting ready
        2. How to do it…
        3. There's more…
      3. Implementing a shared whiteboard
        1. Getting ready
        2. How to do it…
      4. Implementing a real-time map of flying airplanes
        1. Getting ready
        2. How to do it…
      5. Implementing a "pets finder" application
        1. Getting ready
        2. How to do it…
      6. Implementing a custom backplane
        1. Getting ready
        2. How to do it…
        3. There's more…
      7. Implementing a real-time error notification system
        1. Getting ready
        2. How to do it…
        3. There's more…
    17. A. Creating Web Projects
      1. Introduction
      2. Creating an empty ASP.NET web application
      3. Creating an ASP.NET web forms application
      4. Creating an ASP.NET MVC application
      5. Creating an MVC controller and a related view
      6. Creating an ASP.NET website
    18. B. Insights
      1. Transport strategies
      2. Asynchronous programming and SignalR
    19. Index

Product information

  • Title: SignalR Real-time Application Cookbook
  • Author(s): Roberto Vespa
  • Release date: April 2014
  • Publisher(s): Packt Publishing
  • ISBN: 9781783285952