SignalRems.Core
1.0.20
See the version list below for details.
dotnet add package SignalRems.Core --version 1.0.20
NuGet\Install-Package SignalRems.Core -Version 1.0.20
<PackageReference Include="SignalRems.Core" Version="1.0.20" />
<PackageVersion Include="SignalRems.Core" Version="1.0.20" />
<PackageReference Include="SignalRems.Core" />
paket add SignalRems.Core --version 1.0.20
#r "nuget: SignalRems.Core, 1.0.20"
#:package SignalRems.Core@1.0.20
#addin nuget:?package=SignalRems.Core&version=1.0.20
#tool nuget:?package=SignalRems.Core&version=1.0.20
SignalR EMS
Description
SignalRems is one Enterprise Messaging System (EMS) implemented by .NET Standard SignalR. It provides two communication models, RPC and PUB/SUB. This library will provide strong typed API to help client application communicate with server. It is using Newtonsoft.json or MessagePack for serialization/deserialization. In PUB/SUB mode, it subscribes with filter of Lambda expression.
Dependency
This libiary is built on SingalR, hence the server application must be using "Microsoft.NET.Sdk.Web" SDK. The client side could use any .net SDK. Currently this project runs under dotnet core 8.0 and above.
API usage
RPC Server
- Configure WebApplication builder;
var builder = WebApplication.CreateBuilder(args);
// Using Json serialization/deserialization
builder.Services.AddSignalRemsService();
// Or, using MessagePack serialization/deserialization
// builder.Services.AddSignalRemsService(true);
- Setup endpoint for app instance:
var app = builder.Build();
app.MapSignalRemsRpcHub("/signalr/ems/example/rpc");
- Register RPC handler in IRpcService instance. IRpcService instance is singleton and can be get from dependency injection, handler implements IRpcHandler<,> interface to handle the RPC logic;
IRpcService rpcService;
IRpcHandler<GetUserNameRequest, GetUserNameResponse> handler;
rpcService.RegisterHandler<GetUserNameRequest, GetUserNameResponse>(handler);
RPC Client
- Config RPC client into dependency injection;
services.AddSignalRemsClient(); // Using Json serialization/deserialization
// services.AddSignalRemsClient(true); // MessagePack serialization/deserialization
- Make connection and call:
await _rpcClient.ConnectAsync("https://localhost:7198", "/signalr/ems/example/rpc", stoppingToken);
var request = new GetUserNameRequest() { UserId = i.ToString() };
var response = await _rpcClient.SendAsync<GetUserNameRequest, GetUserNameResponse>(request);
PUB/SUB Server
- Configure WebApplication builder;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSignalRemsService();
- Setup endpoint for app instance:
var app = builder.Build();
app.MapSignalRemsPublisherHub("/signalr/ems/example/pubsub");
- Create publisher from IPublisherService, IPublisherService is singleton instance;
IPublisherService publisherService;
var publisher = _publisherService.CreatePublisher<Person, int>("Message");
- Publish item to topic
publisher.Publish(new Person() { Id = id, Age = random.Next(95), Name = $"Person_{id:000}" });
PUB/SUB Client
- Config subscriber client into dependency injection;
services.AddSignalRemsClient();
- Make connection and call. It supports Lambda expression as filter. This Lambda expression must be able to be explained from both server and client.
ISubscriptionHandler<Person> handler;
await _subscriberClient.ConnectAsync("https://localhost:7198", "/signalr/ems/example/pubsub", stoppingToken);
// Subscribe people whose age is over 60.
var subscription = await _subscriberClient.SubscribeAsync("Message", _personHandler, p=> p.Age > 60);
// Or, subscribe people with given Id 1, 2, 3, as one client can only make one subscription, this example shows in comment.
// var subscriptionByKeys = await _subscriberClient.SubscribeWithKeysAsync("Message", _personHandler, 1, 2, 3);
Please note, if using subscription without keys, one client can only be used to do one subscription. The dispose method will stop the subscription and disconnect from server. We can get multiple client instances from DI container to subscribe with differnet topic/filter. If using subscription by keys mode, the client can be used to subscribe/unsubscribe by keys multiple times, but it can't subscribe without given keys.
License
This project is open source and follows MIT license.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.AspNetCore.SignalR.Protocols.MessagePack (>= 10.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Serialize.Linq (>= 4.4.1)
- SharpZipLib (>= 1.4.2)
-
net8.0
- Microsoft.AspNetCore.SignalR.Protocols.MessagePack (>= 10.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Serialize.Linq (>= 4.4.1)
- SharpZipLib (>= 1.4.2)
-
net9.0
- Microsoft.AspNetCore.SignalR.Protocols.MessagePack (>= 10.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Serialize.Linq (>= 4.4.1)
- SharpZipLib (>= 1.4.2)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on SignalRems.Core:
| Package | Downloads |
|---|---|
|
SignalRems.Client
Package Description |
|
|
SignalRems.Server
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.21 | 36 | 7/18/2026 |
| 1.0.20 | 136 | 7/9/2026 |
| 1.0.19 | 183 | 2/11/2026 |
| 1.0.18 | 355 | 8/27/2025 |
| 1.0.17 | 344 | 10/9/2024 |
| 1.0.16 | 307 | 9/24/2024 |
| 1.0.15 | 379 | 8/8/2023 |
| 1.0.14 | 791 | 10/10/2022 |
| 1.0.13 | 792 | 9/29/2022 |
| 1.0.12 | 811 | 8/25/2022 |
| 1.0.11 | 788 | 8/22/2022 |
| 1.0.10 | 804 | 7/25/2022 |
| 1.0.9 | 786 | 7/23/2022 |
| 1.0.8 | 864 | 7/12/2022 |
| 1.0.7 | 818 | 7/12/2022 |
| 1.0.6 | 838 | 7/3/2022 |
| 1.0.5 | 808 | 6/24/2022 |
| 1.0.4 | 817 | 6/24/2022 |
| 1.0.3 | 844 | 6/23/2022 |
| 1.0.2 | 831 | 6/13/2022 |