O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

SignalR - Real-time Application Development - Second Edition

Book Description

A fast-paced guide to develop, test, and deliver real-time communication in your .Net applications using SignalR

About This Book

  • Build and test real-time apps in .Net using the new features of SignalR
  • Explore the fundamentals and the new methods and functions in the latest version of SignalR along with developing a complete application from scratch
  • A progressive, hands-on guide to gain an understanding of the SignalR framework

Who This Book Is For

If you are a .Net developer with good understanding of the .Net platform then this is an ideal book for you to learn how to build real-time apps using the SignalR framework.

What You Will Learn

  • Explore the basic knowledge and understanding of SignalR
  • Get to know how to connect client to the server
  • Connecting a client with a server and setting a hub
  • Creating group connections together
  • Understand how to have state in the client to have specific operations
  • Securing SignalR connections
  • How to scale SignalR across multiple servers
  • Building a client for WPF
  • Building a client using Xamarin targeting Windows, iPhone and Android
  • Get to grips with monitoring the traffic in SignalR using Fiddler for Windows and Charles for OSX
  • Setting up code to host SignalR using OWIN

In Detail

With technology trends, demands on software have changed with more and more skilled users. Over the past few years, with services such as Facebook, Twitter and push notifications on smartphones, users are now getting used to being up to date with everything that happens all the time. With SignalR, the applications stay connected and will generate notifications when something happens either from the system or by other users thus giving new opportunities to enter into this new, exciting world of real-time application development.

This is a step-by-step guide that follows a practical approach helping you as a developer getting to get started with SignalR by learning its fundamentals. It will help you through building real-time applications using the new methods and functions in the SignalR framework. Starting from getting persistent connections with the server, you will learn the basics of connecting a client to the server and how the messaging works. This will be followed by setting up a hub on the server and consuming it from a JavaScript client. Next you will be taught how you can group connections together to send messages. We will then go on to know how you can have state in the client to handle specific operations like connecting or disconnecting. Then, moving on you will learn how to secure your SignalR connections using OWIN and scaling SignalR across multiple servers. Next you will learn building a client for WPF and building a client using Xamarin that targets Windows Phone, iPhone and Android. Lastly, you will learn how to monitor the traffic in SignalR using Fiddler, Charles and hosting SignalR using OWIN.

Style and approach

This is an example- oriented and comprehensive guide to learning the fundamentals of SignalR to build real-time applications. It will help you build real-time applications on the .Net platform in a step-by-step manner along with giving teaching techniques to deal with possible performance bottlenecks and other key topics.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. SignalR – Real-time Application Development Second Edition
    1. Table of Contents
    2. SignalR – Real-time Application Development Second Edition
    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. The emperor's new clothes
      2. The good old terminal
      3. X Server
      4. Remote desktop
      5. Rich clients
      6. The Web
        1. Full duplex on the Web
        2. Events
        3. Comet
          1. Hand-rolling it all
        4. Why?
        5. Now what?
        6. Think different
        7. Personal style
      7. What this book covers
      8. What you need for this book
      9. Who this book is for
      10. Conventions
      11. Reader feedback
      12. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    9. 1. The Primer
      1. Where are we coming from?
        1. The terminal
        2. Fast forwarding
        3. Completing the circle
        4. SignalR
      2. Terminology
        1. Messaging
        2. Publish/subscribe
        3. Decoupling
      3. Patterns
        1. Model View Controller
        2. Model View ViewModel
      4. Libraries and frameworks
        1. jQuery
        2. ASP.NET MVC 5
        3. AngularJS
        4. Twitter Bootstrap
      5. Tools
        1. Visual Studio 2013
        2. NuGet
      6. Summary
    10. 2. Persistent Connections
      1. Persistent connections – what are they?
      2. Where are we going?
      3. Getting the project ready
        1. Setting up the packages
        2. The single page application
        3. The "code-behind"
      4. Getting started with the server-side
        1. Connecting the dots
        2. Making the UI light up
      5. Summary
    11. 3. Hubs
      1. Moving up a level
      2. The client
      3. Decoupling it all
        1. The Dependency Inversion Principle
        2. Proxies
      4. Life cycle events
      5. Separation
      6. Summary
    12. 4. Groups
      1. Getting specific with groups
      2. Composing the UI
      3. Summary
    13. 5. State
      1. Becoming stateful
        1. The client
        2. Lifetime event handlers and more
      2. Summary
    14. 6. Security
      1. Locking things down
      2. Putting the infrastructure in place
      3. HTTP handler config
      4. Authentication
      5. Securing the hub
      6. The great finale
      7. Summary
    15. 7. Scaling Out
      1. It's all about messages in SignalR
        1. Scaling out with SQL Server
        2. Scaling out with Redis
        3. Scaling out with Azure
        4. Creating our own backplane
          1. Hooking it all up
      2. Summary
    16. 8. Building a WPF .NET Client
      1. Decoupling it all
      2. Decoupling – the next level
      3. Building for the desktop
        1. Setting up the packages
        2. Observables
        3. Adding security
          1. Adding support for cookies
          2. Binding helper
          3. Creating a client security service
          4. Adding a login view
        4. The hub proxy
        5. Our chat rooms
        6. The chat
        7. The composition
      4. Summary
    17. 9. Write Once, Deploy Many
      1. Cross platform
      2. Getting started
      3. Code signing
      4. Preparing for connections
      5. Packages
      6. MVVM
        1. Messenger
        2. DelegateCommand
        3. Security
        4. ChatHub
        5. Login
        6. ChatRooms
        7. Chat
      7. The result
      8. Summary
    18. 10. Monitoring
      1. Logging
        1. Logging on the server side
        2. Logging in the JavaScript client
        3. Logging in the .NET client
        4. Logging from the Xamarin client
      2. Digging deeper into the communication
        1. Looking under the cover with Fiddler
        2. Performance counters
        3. Under the cover, inside the browser
      3. Summary
    19. 11. Hosting a Server Using Self-hosted OWIN
      1. Self-hosting
        1. Adding the needed packages
        2. Adding the code needed for self-hosting
        3. The client
      2. Summary
    20. Index