Adding and registering a persistent connection

In this first recipe of the chapter, we'll introduce the PersistentConnection type, and we'll go into the details about how it works, how to use it, and how to register it into SignalR to expose it to the connected clients. Our goal for the sample code is to trace any attempt of connection from a client towards the exposed endpoint. We will also write a minimal JavaScript client in order to actually test its behavior.

Getting ready

Before writing the code of this recipe, we need to create a new empty web application that we'll call Recipe25.

How to do it…

Let's run through the steps necessary to accomplish our goal:

  1. We first need to add a new class derived from PersistentConnection. We can navigate to ...

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.