Redis

Redis is an open-source in memory data source used by Harmony for scaling Harmony.SignalR application. Clients served by the Harmony.Api app, connect to an instance of Harmony.SignalR application to receive instance updates via WebSocket. Redis backplance is used to support the scenario where you may have multiple instances of Harmony.SignalR app and different clients have been connected to different instances. Applications send messages to Harmony.SignalR via RabbitMQ messages.

Installing Redis is optional and only required when you have actually more than one instances of Harmony.SignalR application running.

In case you are running Harmony with just one instance of Harmony.SignalR then you are good to skip the entire Redis section.

Installation

Follow the official installation instructions for installing Redis on your environment. The easiest way to run a Redis instance locally is by using a docker container. Expose a port outside the container so that other apps can connect to it.

Next configure the RedisConnectionString connection string in the appsettings.json for Harmony.SignalR project. The following configuration connects to a local Redis instance listening to the default 6379 port.

"RedisConnectionString": "127.0.0.1:6379",

Important! After configuring Harmony.SignalR, set the signalrHostUrl property inside the appsettings.json file existing in the Harmony.Client project in the www folder. This is Harmony.SignalR project's host URL and clients will try to connect to it in order to receive instant updates via WebSockets. By default when running through Visual Studio, Harmony.SignalR will listen on port 7262.

{
  "signalrHostUrl": "https://localhost:7262"
}

Read next - Configure RabbitMQ

📬pageRabbitMQ

Last updated