SignalRems.Client
0.1.0-preview
See the version list below for details.
dotnet add package SignalRems.Client --version 0.1.0-preview
NuGet\Install-Package SignalRems.Client -Version 0.1.0-preview
<PackageReference Include="SignalRems.Client" Version="0.1.0-preview" />
paket add SignalRems.Client --version 0.1.0-preview
#r "nuget: SignalRems.Client, 0.1.0-preview"
// Install SignalRems.Client as a Cake Addin #addin nuget:?package=SignalRems.Client&version=0.1.0-preview&prerelease // Install SignalRems.Client as a Cake Tool #tool nuget:?package=SignalRems.Client&version=0.1.0-preview&prerelease
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 MessagePack binary format for serialization/deserialization . In PUB/SUB mode, it subscribe 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 6.0 SDK.
API usage
RPC Server
- Configure WebApplication builder;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSignalRemsService();
- 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
- Get RPC client from dependency injection;
_rpcClient = ServiceProvider.GetRequiredService<IRpcClient>();
- 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
- Get subscriber client from dependency injection;
_subscriberClient = ServiceProvider.GetRequiredService<ISubscriberClient>();
- 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);
var subscription = await _subscriberClient.SubscribeAsync("Message", handler, p=> p.Age > 60);
- The handler
License
This project is open source and follows MIT license.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. |
-
net6.0
- Microsoft.AspNetCore.SignalR.Client (>= 6.0.3)
- Microsoft.AspNetCore.SignalR.Protocols.MessagePack (>= 6.0.3)
- SignalRems.Core (>= 0.1.0-preview)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.0.17 | 98 | 10/9/2024 | |
1.0.16 | 106 | 9/24/2024 | |
1.0.15 | 192 | 8/8/2023 | |
1.0.14 | 408 | 10/10/2022 | |
1.0.13 | 416 | 9/29/2022 | |
1.0.12 | 407 | 8/25/2022 | |
1.0.11 | 393 | 8/22/2022 | |
1.0.10 | 399 | 7/25/2022 | |
1.0.9 | 401 | 7/23/2022 | |
1.0.8 | 427 | 7/12/2022 | |
1.0.7 | 420 | 7/12/2022 | |
1.0.6 | 449 | 7/3/2022 | |
1.0.5 | 415 | 6/24/2022 | |
1.0.4 | 407 | 6/24/2022 | |
1.0.3 | 416 | 6/23/2022 | |
1.0.2 | 410 | 6/13/2022 | |
1.0.1 | 421 | 6/10/2022 | |
1.0.0 | 417 | 6/7/2022 | |
0.2.2-preview | 156 | 4/5/2022 | |
0.2.1-preview | 194 | 4/3/2022 | |
0.2.0-preview | 188 | 4/3/2022 | |
0.1.2-preview | 192 | 4/2/2022 | |
0.1.1-preview | 205 | 4/1/2022 | |
0.1.0-preview | 204 | 3/31/2022 |