SharpChannels.Core
1.0.0-beta
dotnet add package SharpChannels.Core --version 1.0.0-beta
NuGet\Install-Package SharpChannels.Core -Version 1.0.0-beta
<PackageReference Include="SharpChannels.Core" Version="1.0.0-beta" />
paket add SharpChannels.Core --version 1.0.0-beta
#r "nuget: SharpChannels.Core, 1.0.0-beta"
// Install SharpChannels.Core as a Cake Addin #addin nuget:?package=SharpChannels.Core&version=1.0.0-beta&prerelease // Install SharpChannels.Core as a Cake Tool #tool nuget:?package=SharpChannels.Core&version=1.0.0-beta&prerelease
SharpChannels is a simple and lightweight communication library for .NET.
What?
Two things:
- Gives you the higher level entities to use for messaging instead of the byte streams and sockets.
Namely: channels and messages - Implements well-known messaging scenarios
- request-response
- publisher-subscriber
- service bus
Why?
It is very expensive to develop a reliable server and client (using TCP for example), implement an application layer protocol for messaging, and then use all this stuff in a communication scenarios, like response to the requestor, broadcasts message to the subscribers etc.
SharpChannels has already done it all.
Use entities which can send and receive messages rather than write the byte sequence to or read it from stream. It also gives you a seamless switching between transport protocols.
Transports
- TCP
- In-process (inside AppDomain)
Security
- TLS 1.2
Serialization
- built-in for text messages
- built-in for binary messages
- native (using BinaryFormatter class)
- proto-buf
- custom user serialization
Other features
- version based handshake
- explicit channel closing (as in SCTP)
Usage
Нere is a simple example of request-response messaging using SharpChannels
Server side:
var serializer = new StringMessageSerializer();
var serverCommunication = new TcpCommunication<StringMessage>(
new TcpEndpointData(IPAddress.Any, 2000),
serializer);
var server = Scenarios.RequestResponse.SetupServer(serverCommunication)
.UsingNewClientHandler((sender, a) => { Console.WriteLine("channel opened"); })
.UsingRequestHandler((sender, a) =>
{
a.Response = new StringMessage(a.Request.Message.Replace("request", "response"));
})
.UsingChannelClosedHandler((sender, a) => { Console.WriteLine("channel closed"); })
.Go();
Client side:
var clientCommunication = new TcpCommunication<StringMessage>(
new TcpEndpointData(IPAddress.Loopback, 2000),
serializer);
var r = Scenarios.RequestResponse.Requester(clientCommunication);
using (r.Channel)
{
r.Channel.Open();
for (int i = 0; i < 100; i++)
{
var requestMessage = new StringMessage($"request #{i}");
Console.WriteLine(requestMessage);
var responseMessage = r.Request(requestMessage);
Console.WriteLine(responseMessage);
}
r.Channel.Close();
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SharpChannels.Core:
Package | Downloads |
---|---|
SharpChannels.Protobuf
Protobuf based serializer for SharpChannels |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0-beta | 881 | 1/18/2018 |