# SignalR

The **SignalR** service incorporates the required functionality to allow for:

* SignalR and/or REST requests to your service
* JWT Authentication of those requests
* The handling of the operations that are to be executed when a request is received

{% hint style="info" %}
**Quick Steps**

1. Add `SignalR` **plugin** to your solution.
2. Drag the `SignalR` service onto the Solution Explorer panel.
3. Set **properties** for the service. (See below for details.)
4. Add Server method (e.g. SendMessage) and Client method (e.g. ReceiveMessage) in the Methods Editor.
5. Drag required **functions** and **types** onto the design canvas of an event that was created for your service when you added the Server method (e.g. SendMessage) in the previous step.
6. Click **Debug** (on the top toolbar) to test and debug your solution, or right-click on the service or service event (in the Solution Explorer), then select Debug to specifically test and debug the service.
   {% endhint %}

***

## Properties <a href="#properties" id="properties"></a>

### Hub URL <a href="#hub-url" id="hub-url"></a>

SignalR hub URL, e.g. `http://localhost/chatHub`.

**What is a hub?**\
SignalR uses hubs to communicate between clients and servers. [learn more](https://docs.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-5.0).

***

### Security <a href="#security" id="security"></a>

The type of security used for authentication.

Select either `None` or `JWT Authentication`.

When selecting JWT Authentication, provide the following:

#### Secret key <a href="#secret-key" id="secret-key"></a>

Secret key used to validate the JWT token.

#### Claims <a href="#claims" id="claims"></a>

Comma-separated list of claim names to resolve on the event input, e.g. `"name,exp"`.

***

### Server methods <a href="#server-methods" id="server-methods"></a>

Click the **...** icon to open the `Methods Editor` to add a collection of server-side SignalR methods.

Specify the names and parameters of the server methods that are to be executed as events when your SignalR service is accessed.

### Client methods <a href="#client-methods" id="client-methods"></a>

Click the **...** icon to open the `Methods Editor` to add a collection of client-side SignalR methods.

Specify the names and parameters of the client methods that are to be executed as events when your SignalR service is accessed.

<figure><img src="https://3338214469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1nxDeDH8GVCXb0XelqGm%2Fuploads%2Fgit-blob-3380c7704e28caf1b7f23931efd8c1efaf1c207e%2Fsignalr2.png?alt=media" alt="SignalR methods"><figcaption><p>SignalR Methods Editor</p></figcaption></figure>

{% hint style="info" %}
**Note:**\
For each `Event` that is created, you have to add relevant functions to that Event to execute the associated Method.
{% endhint %}

***

## Links <a href="#links" id="links"></a>

[Introduction to SignalR](https://docs.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-5.0)
