ManagedCode.Orleans.SignalR.Core
7.2.1
Prefix Reserved
See the version list below for details.
dotnet add package ManagedCode.Orleans.SignalR.Core --version 7.2.1
NuGet\Install-Package ManagedCode.Orleans.SignalR.Core -Version 7.2.1
<PackageReference Include="ManagedCode.Orleans.SignalR.Core" Version="7.2.1" />
paket add ManagedCode.Orleans.SignalR.Core --version 7.2.1
#r "nuget: ManagedCode.Orleans.SignalR.Core, 7.2.1"
// Install ManagedCode.Orleans.SignalR.Core as a Cake Addin #addin nuget:?package=ManagedCode.Orleans.SignalR.Core&version=7.2.1 // Install ManagedCode.Orleans.SignalR.Core as a Cake Tool #tool nuget:?package=ManagedCode.Orleans.SignalR.Core&version=7.2.1
Orleans.SignalR
Orleans.SignalR is a lightweight, open-source library that enables easy integration of SignalR with Orleans, a distributed virtual actor model framework for building scalable, fault-tolerant systems. The library provides a SignalR backplane, allowing you to effortlessly add real-time communication capabilities to your distributed systems.
Features
Orleans.SignalR offers the following features:
- Simple and clear implementation
- Seamless integration with SignalR
- Support for all SignalR functions, including ClientInvocation
Installation
You can install Orleans.SignalR using Nuget
For Client
Install-Package ManagedCode.Orleans.SignalR.Client
For Server
Install-Package ManagedCode.Orleans.SignalR.Server
Usage
Client Configuration
To use Orleans.SignalR on the client, add the following code to your client configuration:
clientBuilder.Services
.AddSignalR()
.AddOrleans();
Server Configuration
To use Orleans.SignalR on the server, add the following code to your server configuration:
siloBuilder.ConfigureOrleansSignalR();
siloBuilder.AddMemoryGrainStorage(OrleansSignalROptions.OrleansSignalRStorage);
siloBuilder.Services
.AddSignalR()
.AddOrleans();
Using HubContext in Grain
In this example, TestGrain defines the interface for the grain, and TestGrain inject the interface for sending messages using SignalR
public class TestGrain : Grain, ITestGrain
{
private readonly IHubContext<InterfaceTestHub> _hubContext;
public TestGrain(IHubContext<InterfaceTestHub> hubContext)
{
_hubContext = hubContext;
}
public Task PushRandom()
{
return _hubContext.Clients.All.SendAsync("SendRandom", new Random().Next());
}
}
You can use typed Orleans client, with interface IOrleansHubContext
public class TestGrain : Grain, ITestGrain
{
private readonly IOrleansHubContext<InterfaceTestHub, IClientInterfaceHub> _hubContext;
public TestGrain(IOrleansHubContext<InterfaceTestHub, IClientInterfaceHub> hubContext)
{
_hubContext = hubContext;
}
public Task PushRandom()
{
return _hubContext.Clients.All.SendMessage(this.GetPrimaryKeyString());
}
}
Using ClientInvocation
Orleans.SignalR supports all functions from SignalR, including ClientInvocation. However, to avoid blocking tasks,
use Task.Run
.
Here's an example:
public async Task<string> GetMessage(string connectionId)
{
var message = await Task.Run(() => _hubContext.Clients.Client(connectionId)
.InvokeAsync<string>("GetMessage", CancellationToken.None));
return message;
}
Contributing
We welcome contributions! If you encounter any bugs or have feature requests, please open an issue. If you want to contribute code, please fork the repository and submit a pull request.
License
Orleans.SignalR is licensed under the MIT License.
Credits
Orleans.SignalR is based on the work of the Orleans community and the SignalR team at Microsoft.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- Microsoft.Orleans.Sdk (>= 7.2.1)
- Microsoft.Orleans.Serialization (>= 7.2.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on ManagedCode.Orleans.SignalR.Core:
Package | Downloads |
---|---|
ManagedCode.Orleans.SignalR.Server
SignalR for Orleans |
|
ManagedCode.Orleans.SignalR.Client
SignalR for Orleans |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.1.1 | 391 | 6/19/2024 |
8.1.0 | 285 | 5/13/2024 |
7.2.1 | 1,508 | 9/12/2023 |
7.1.6 | 263 | 6/6/2023 |
7.1.5 | 219 | 6/2/2023 |
7.1.4 | 215 | 6/2/2023 |
7.1.3 | 209 | 6/1/2023 |
7.1.2 | 204 | 5/31/2023 |
7.1.1 | 208 | 5/31/2023 |
7.1.0 | 205 | 5/25/2023 |
7.0.1 | 214 | 5/23/2023 |
7.0.0 | 250 | 4/26/2023 |
0.0.4 | 254 | 4/25/2023 |
0.0.3 | 233 | 4/24/2023 |
0.0.2 | 258 | 4/23/2023 |
0.0.1 | 264 | 4/4/2023 |