TinyIpc 4.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TinyIpc --version 4.2.0                
NuGet\Install-Package TinyIpc -Version 4.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TinyIpc" Version="4.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TinyIpc --version 4.2.0                
#r "nuget: TinyIpc, 4.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TinyIpc as a Cake Addin
#addin nuget:?package=TinyIpc&version=4.2.0

// Install TinyIpc as a Cake Tool
#tool nuget:?package=TinyIpc&version=4.2.0                

TinyIpc

NuGet Build

.NET inter process broadcast message bus.

Intended for quick broadcast messaging in Windows desktop applications, it just works.

Quick introduction

  • Designed to be serverless
  • Clients may drop in and out at any time
  • Messages expire after a specified timeout, default 500 milliseconds
  • The log is kept small for performance, default max log size is 1 MB
  • Reads are queued and should be received in the same order as they were published

Benefits and drawbacks

It's easy to use and there is no complicated setup. It is suited for small messages, so big messages probably need some other transport mechanism. With high enough throughput messages may be lost if receivers are not able to get a read lock before the message timeout is reached.

Performance

Every publish operation reads and writes the entire contents of a shared memory mapped file and every read operation which is triggered by writes also reads the entire file so if performance is important then batch publish several messages at once to reduce the amount of reads and writes.

OS Support

Unfortunately TinyIpc only works on Windows because the named primitives that are core to this entire solution only works on Windows and throws PlatformNotSupportedException on other operating systems by design.

See https://github.com/dotnet/runtime/issues/4370 for more information.

Compared to other solutions

TinyIPC IpcChannel Named Pipes
Broadcasting to all listeners (except self)
No master process
Insensitive to process privilege level
Entirely in memory

Simple example

One message bus listening to the other. Check ConsoleApp for a sample application.

using var messagebus1 = new TinyMessageBus("ExampleChannel");
using var messagebus2 = new TinyMessageBus("ExampleChannel");

messagebus2.MessageReceived +=
	(sender, e) => Console.WriteLine(Encoding.UTF8.GetString(e.Message));

while (true)
{
	var message = Console.ReadLine();
	await messagebus1.PublishAsync(Encoding.UTF8.GetBytes(message));
}

Example using generic hosting

Equivalent example to the above using generic hosting. Check GenericHost for a sample application.

// Add service to IServiceCollection
services.AddTinyIpc(options =>
{
	options.Name = "ExampleChannel";
});

// Later use ITinyIpcFactory to create instances
using var tinyIpcInstance1 = tinyIpcFactory.CreateInstance();
using var tinyIpcInstance2 = tinyIpcFactory.CreateInstance();

tinyIpcInstance2.MessageBus.MessageReceived +=
	(sender, e) => Console.WriteLine(Encoding.UTF8.GetString(e.Message));

while (true)
{
	var message = Console.ReadLine();
	await tinyIpcInstance1.MessageBus.PublishAsync(Encoding.UTF8.GetBytes(message));
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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 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 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. 
.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on TinyIpc:

Package Downloads
SingleInstanceCore

To create single instance applications on .NET Core/.NET 5

UnicViewIPCInterface

Common interfaces and default implementations for IPC between the new (2023+) UnicView suite of products.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on TinyIpc:

Repository Stars
akira0245/MidiBard
Bard performance plugin for FFXIV.
Version Downloads Last updated
4.3.3 161 11/1/2024
4.3.2 326 7/9/2024
4.3.1 448 5/18/2024
4.3.0 473 12/18/2023
4.2.0 264 11/19/2023
4.1.5 391 9/15/2023
4.1.4 311 6/16/2023
4.1.3 871 3/17/2023
4.1.2 382 2/15/2023
4.1.1 526 12/17/2022
4.1.0 446 11/11/2022
4.0.0 572 9/17/2022
3.1.1 4,825 6/8/2022
3.1.0 742 11/13/2021
3.0.1 66,285 8/16/2021
3.0.0 2,226 12/7/2020
2.1.0 3,746 1/5/2020
2.0.0 1,589 4/5/2019
1.0.3 904 9/30/2018
1.0.2 970 8/3/2018
1.0.1 1,509 6/6/2017
1.0.0 1,247 9/3/2016