SignalR.Orleans 2.0.1

Orleans backplane for SignalR Core.

Install-Package SignalR.Orleans -Version 2.0.1
dotnet add package SignalR.Orleans --version 2.0.1
<PackageReference Include="SignalR.Orleans" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SignalR.Orleans --version 2.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SignalR.Orleans, 2.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install SignalR.Orleans as a Cake Addin
#addin nuget:?package=SignalR.Orleans&version=2.0.1

// Install SignalR.Orleans as a Cake Tool
#tool nuget:?package=SignalR.Orleans&version=2.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Build
Package Version
NuGet Downloads
License
Gitter

Orleans is a framework that provides a straight-forward approach to building distributed high-scale computing applications, without the need to learn and apply complex concurrency or other scaling patterns.

ASP.NET Core SignalR is a new library for ASP.NET Core developers that makes it incredibly simple to add real-time web functionality to your applications. What is "real-time web" functionality? It's the ability to have your server-side code push content to the connected clients as it happens, in real-time.

SignalR.Orleans is a package that allow us to enhance the real-time capabilities of SignalR by leveraging Orleans distributed cloud platform capabilities.

Installation

Installation is performed via NuGet

From Package Manager:

PS> Install-Package SignalR.Orleans

.Net CLI:

# dotnet add package SignalR.Orleans

Paket:

# paket add SignalR.Orleans

Configuration

Silo

We need to configure the Orleans Silo with the below:

  • Use .UseSignalR() on ISiloHostBuilder.
  • Make sure to call RegisterHub<THub>() where THub is the type of the Hub you want to be added to the backplane.

Example

var silo = new SiloHostBuilder()
  .UseSignalR()
  .RegisterHub<MyHub>() // You need to call this per `Hub` type.
  .AddMemoryGrainStorage("PubSubStore") // You can use any other storage provider as long as you have one registered as "PubSubStore".
  .Build();

await silo.StartAsync();

Configure Silo Storage Provider and Grain Persistance

Optional configuration to override the default implementation for both providers which by default are set as Memory.

Example

.UseSignalR(cfg =>
{
  cfg.ConfigureBuilder = (builder, config) =>
  {
    builder
      .AddMemoryGrainStorage(config.PubSubProvider)
      .AddMemoryGrainStorage(config.StorageProvider);
  };
})
.RegisterHub<MyHub>()

Client

Now your SignalR application needs to connect to the Orleans Cluster by using an Orleans Client:

  • Use .UseSignalR() on IClientBuilder.

Example

var client = new ClientBuilder()
  .UseSignalR()
  .Build();

await client.Connect();

Somewhere in your Startup.cs:

  • Add IClusterClient (created in the above example) to IServiceCollection.
  • Use .AddSignalR() on IServiceCollection (this is part of Microsoft.AspNetCore.SignalR nuget package).
  • Use AddOrleans() on .AddSignalR().

Example

public void ConfigureServices(IServiceCollection services)
{
  ...
  services
    .AddSingleton<IClusterClient>(client)
    .AddSignalR()
    .AddOrleans();
  ...
}

Great! Now you have SignalR configured and Orleans SignalR backplane built in Orleans!

Features

Hub Context

HubContext gives you the ability to communicate with the client from orleans grains (outside the hub).

Sample usage: Receiving server push notifications from message brokers, web hooks, etc. Ideally first update your grain state and then push signalr message to the client.

Example

public class UserNotificationGrain : Grain<UserNotificationState>, IUserNotificationGrain
{
  private HubContext<IUserNotificationHub> _hubContext;

  public override async Task OnActivateAsync()
  {
    _hubContext = GrainFactory.GetHub<IUserNotificationHub>();
    // some code...
    await _hubContext.User(this.GetPrimaryKeyString()).Send("Broadcast", State.UserNotification);
  }
}

Contributions

PRs and feedback are very welcome!

Build
Package Version
NuGet Downloads
License
Gitter

Orleans is a framework that provides a straight-forward approach to building distributed high-scale computing applications, without the need to learn and apply complex concurrency or other scaling patterns.

ASP.NET Core SignalR is a new library for ASP.NET Core developers that makes it incredibly simple to add real-time web functionality to your applications. What is "real-time web" functionality? It's the ability to have your server-side code push content to the connected clients as it happens, in real-time.

SignalR.Orleans is a package that allow us to enhance the real-time capabilities of SignalR by leveraging Orleans distributed cloud platform capabilities.

Installation

Installation is performed via NuGet

From Package Manager:

PS> Install-Package SignalR.Orleans

.Net CLI:

# dotnet add package SignalR.Orleans

Paket:

# paket add SignalR.Orleans

Configuration

Silo

We need to configure the Orleans Silo with the below:

  • Use .UseSignalR() on ISiloHostBuilder.
  • Make sure to call RegisterHub<THub>() where THub is the type of the Hub you want to be added to the backplane.

Example

var silo = new SiloHostBuilder()
  .UseSignalR()
  .RegisterHub<MyHub>() // You need to call this per `Hub` type.
  .AddMemoryGrainStorage("PubSubStore") // You can use any other storage provider as long as you have one registered as "PubSubStore".
  .Build();

await silo.StartAsync();

Configure Silo Storage Provider and Grain Persistance

Optional configuration to override the default implementation for both providers which by default are set as Memory.

Example

.UseSignalR(cfg =>
{
  cfg.ConfigureBuilder = (builder, config) =>
  {
    builder
      .AddMemoryGrainStorage(config.PubSubProvider)
      .AddMemoryGrainStorage(config.StorageProvider);
  };
})
.RegisterHub<MyHub>()

Client

Now your SignalR application needs to connect to the Orleans Cluster by using an Orleans Client:

  • Use .UseSignalR() on IClientBuilder.

Example

var client = new ClientBuilder()
  .UseSignalR()
  .Build();

await client.Connect();

Somewhere in your Startup.cs:

  • Add IClusterClient (created in the above example) to IServiceCollection.
  • Use .AddSignalR() on IServiceCollection (this is part of Microsoft.AspNetCore.SignalR nuget package).
  • Use AddOrleans() on .AddSignalR().

Example

public void ConfigureServices(IServiceCollection services)
{
  ...
  services
    .AddSingleton<IClusterClient>(client)
    .AddSignalR()
    .AddOrleans();
  ...
}

Great! Now you have SignalR configured and Orleans SignalR backplane built in Orleans!

Features

Hub Context

HubContext gives you the ability to communicate with the client from orleans grains (outside the hub).

Sample usage: Receiving server push notifications from message brokers, web hooks, etc. Ideally first update your grain state and then push signalr message to the client.

Example

public class UserNotificationGrain : Grain<UserNotificationState>, IUserNotificationGrain
{
  private HubContext<IUserNotificationHub> _hubContext;

  public override async Task OnActivateAsync()
  {
    _hubContext = GrainFactory.GetHub<IUserNotificationHub>();
    // some code...
    await _hubContext.User(this.GetPrimaryKeyString()).Send("Broadcast", State.UserNotification);
  }
}

Contributions

PRs and feedback are very welcome!

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on SignalR.Orleans:

Repository Stars
OrleansContrib/SignalR.Orleans
SignalR backend based on Orleans.

Version History

Version Downloads Last updated
2.0.1 733 2/15/2021
1.5.0 11,054 11/1/2019
1.4.4 753 11/1/2019
1.4.3 6,469 9/23/2019
1.4.2 1,905 9/8/2019
1.4.0 2,998 7/8/2019
1.3.2 2,665 6/13/2019
1.3.1 493 6/10/2019
1.2.0 1,975 3/21/2019
1.1.2 374 2/25/2019
1.1.1 814 1/24/2019
1.0.6 2,815 10/12/2018
1.0.5 1,078 7/24/2018
1.0.4 458 7/24/2018
1.0.3 484 7/4/2018
1.0.2 523 7/4/2018
1.0.1 576 6/23/2018
1.0.0-preview-65 782 5/31/2018
1.0.0-preview-63 635 5/8/2018
1.0.0-preview-60 524 4/25/2018
1.0.0-preview-58 522 4/24/2018
1.0.0-preview-52 652 3/28/2018
1.0.0-preview-50 722 3/28/2018
1.0.0-preview-47 589 3/16/2018
1.0.0-preview-44 535 3/13/2018
1.0.0-preview-42 530 3/5/2018
1.0.0-preview-39 536 3/5/2018
1.0.0-preview-37 533 3/2/2018
1.0.0-preview-32 991 12/21/2017
1.0.0-preview-26 547 12/12/2017
1.0.0-preview-22 526 11/24/2017
1.0.0-preview-19 508 11/22/2017