SignalR.Orleans 1.1.2

SignalR.Orleans - Orleans backplane for SignalR Core

Orleans backplane for SignalR Core.

There is a newer version of this package available.
See the version list below for details.
Install-Package SignalR.Orleans -Version 1.1.2
dotnet add package SignalR.Orleans --version 1.1.2
<PackageReference Include="SignalR.Orleans" Version="1.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SignalR.Orleans --version 1.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Configuration

Silo

We need to configure the Orleans Silo with the below:

  • Use .UseSignalR() on ISiloHostBuilder.

Example

var silo = new SiloHostBuilder()
    .UseSignalR()
    .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);
    };
})

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:

  • Use .AddSignalR() on IServiceCollection (this is part of Microsoft.AspNetCore.SignalR nuget package).
  • Use AddOrleans() on .AddSignalR().

Example

public void ConfigureServices(IServiceCollection services)
{
    ...
    services
        .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()).SendSignalRMessage("Broadcast", State.UserNotification);
	}
}

Configuration

Silo

We need to configure the Orleans Silo with the below:

  • Use .UseSignalR() on ISiloHostBuilder.

Example

var silo = new SiloHostBuilder()
    .UseSignalR()
    .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);
    };
})

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:

  • Use .AddSignalR() on IServiceCollection (this is part of Microsoft.AspNetCore.SignalR nuget package).
  • Use AddOrleans() on .AddSignalR().

Example

public void ConfigureServices(IServiceCollection services)
{
    ...
    services
        .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()).SendSignalRMessage("Broadcast", State.UserNotification);
	}
}

Version History

Version Downloads Last updated
1.3.2 37 6/13/2019
1.3.1 138 6/10/2019
1.2.0 1,611 3/21/2019
1.1.2 123 2/25/2019
1.1.1 523 1/24/2019
1.0.6 822 10/12/2018
1.0.5 763 7/24/2018
1.0.4 156 7/24/2018
1.0.3 181 7/4/2018
1.0.2 187 7/4/2018
1.0.1 234 6/23/2018
1.0.0-preview-65 458 5/31/2018
1.0.0-preview-63 307 5/8/2018
1.0.0-preview-60 197 4/25/2018
1.0.0-preview-58 181 4/24/2018
1.0.0-preview-52 301 3/28/2018
1.0.0-preview-50 390 3/28/2018
1.0.0-preview-47 256 3/16/2018
1.0.0-preview-44 206 3/13/2018
1.0.0-preview-42 199 3/5/2018
1.0.0-preview-39 200 3/5/2018
1.0.0-preview-37 201 3/2/2018
1.0.0-preview-32 671 12/21/2017
1.0.0-preview-26 208 12/12/2017
1.0.0-preview-22 214 11/24/2017
1.0.0-preview-19 191 11/22/2017