Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

Frequently Asked Questions

Brady Gaster edited this page Nov 7, 2018 · 6 revisions

This document will condense some of the more popular questions and themes that have come up in the issues we've received on SignalR. Please check the FAQ before you submit a new issue, as the issue may have already been addressed below.


What is SignalR?

SignalR is a series of libraries for both the server and client that make it incredibly simple to add real-time functionality to your apps. You can learn more about SignalR in the SignalR documentation.

How does SignalR enable "real-time HTTP?"

There are two sets of open-source libraries that make this possible:

  1. Various client-side packages that enable the real-time functionality are available. These clients can be used with either a server-side Hub instance authored in .NET, or with the SignalR Azure Service.

    1. Java
    2. JavaScript
    3. .NET
  2. Developers who are using .NET Core on the server side to build custom real-time endpoints use SignalR Hubs, which are available as a part of .NET Core (via the ASP.NET Core NuGet).

  3. Developers who simply need the real-time endpoint and who want to use custom client-side code to handle all events coming from the server should use of the SignalR Azure Service.

What is the difference between ASP.NET SignalR and ASP.NET Core SignalR?

The best resource to get started understanding the differences between the two is to begin with the docs.

Does SignalR Reconnect Automatically?

No. SignalR clients need to be manually reconnected. Below you will see some example JavaScript code that demonstrates one method of performing a reconnection.

const start = () => {
    try {
        await connection.start()
        console.log('connected')
    } catch (err) {
        console.log(err)
        setTimeout(() => start(), 5000)
    }
}

connection.onclose(function () {
    start();
});

Can I access QueryString or Form variables in my Hub routes?

Reading query string parameters in the hub is not recommended as SignalR is generally not directly tied to a single HTTP request (there are multiple requests going on throughout the connection). However, if it's essential to your scenario and can't be done any other way, you can access the entire HTTP context (including the query string) via Context.GetHttpContext() in the Hub.

Clone this wiki locally