TinyIpc 5.0.0

dotnet add package TinyIpc --version 5.0.0                
NuGet\Install-Package TinyIpc -Version 5.0.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="5.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TinyIpc --version 5.0.0                
#r "nuget: TinyIpc, 5.0.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=5.0.0

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

TinyIpc

NuGet Build

TinyIpc is a lightweight, serverless .NET inter-process broadcast message bus designed for simplicity and performance in Windows desktop applications.

Table of Contents

Features

  • Serverless Architecture: No master process required.
  • Flexible Messaging: Clients can join or leave at any time.
  • Automatic Expiration: Messages expire after a configurable timeout (default: 1 second).
  • Memory Efficient: Default max log size is 1 MB for high performance.
  • FIFO Guarantee: Messages are received in the order they are published.
  • Fully async: Supports receiving events in callbacks or via async enumerable

Benefits and Limitations

Benefits

  • Easy to set up, no complex configurations required.
  • Ideal for small, quick messages.
  • Fully in-memory for high-speed communication.
  • Can batch send many messages in one operation.
  • Broadcast messages to all listeners (except the sender).

Limitations

  • Windows only: Relies on named primitives unavailable on other platforms.
  • Message size: Not suitable for large payloads.
  • Timeout sensitivity: High throughput can lead to message loss if receivers fail to acquire locks in time.

Performance

Every publish operation reads and writes the entire shared memory mapped file, and every receive operation which is triggered after writes also reads the entire file.

Thus, if high throughput is desired, batch publish several messages at once to reduce I/O operations.

OS Support

TinyIpc currently supports Windows only due to reliance on platform-specific primitives.

For more details, refer to this issue.

Feature Comparison

TinyIPC IpcChannel Named Pipes
Broadcasting to all listeners (except self)
Serverless architecture
Process privilege agnostic
Fully in-memory

Examples

Simple Example

Check ConsoleApp for a sample application.

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

messagebus2.MessageReceived +=
	(sender, e) => Console.WriteLine(e.Message.ToString());

while (true)
{
	var message = Console.ReadLine();
	await messagebus1.PublishAsync(BinaryData.FromString(message));
}

Generic Hosting Example

Check GenericHost for a sample application.

// Add a reusable ITinyMessageBus
services.AddTinyMessageBus(options =>
{
	options.Name = "ExampleChannel";
});

// Then use ITinyMessageBus via dependency injection
public class SomeService(ITinyMessageBus tinyMessageBus)
{
	public Task PublishMessage(string message)
	{
		return tinyMessageBus.PublishAsync(BinaryData.FromString(message));
	}

	public async Task Subscribe()
	{
		await foreach (var message in tinyMessageBus.SubscribeAsync())
		{
			Console.WriteLine(message.ToString());
		}
	}
}

Advanced Usage

You can also add keyed instances with different settings.

services.AddKeyedTinyMessageBus("instance1", options =>
{
	options.Name = "Channel1";
});

services.AddKeyedTinyMessageBus("instance2", options =>
{
	options.Name = "Channel2";
});

// Then resolve them using [FromKeyedServices(serviceKey)] or via a IServiceProvider

Or you might need to use dependency injection and create multiple instances communicating with the same message bus in the same application.

// Add a factory service to IServiceCollection
services.AddTinyIpcFactory(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(e.Message.ToString());

while (true)
{
	var message = Console.ReadLine();
	await tinyIpcInstance1.MessageBus.PublishAsync(BinaryData.FromString(message));
}
Product 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 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. 
.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
5.0.0 109 11/23/2024
4.3.3 189 11/1/2024
4.3.2 345 7/9/2024
4.3.1 460 5/18/2024
4.3.0 481 12/18/2023
4.2.0 269 11/19/2023
4.1.5 396 9/15/2023
4.1.4 316 6/16/2023
4.1.3 881 3/17/2023
4.1.2 387 2/15/2023
4.1.1 531 12/17/2022
4.1.0 451 11/11/2022
4.0.0 577 9/17/2022
3.1.1 4,884 6/8/2022
3.1.0 747 11/13/2021
3.0.1 67,490 8/16/2021
3.0.0 2,231 12/7/2020
2.1.0 3,752 1/5/2020
2.0.0 1,596 4/5/2019
1.0.3 909 9/30/2018
1.0.2 975 8/3/2018
1.0.1 1,515 6/6/2017
1.0.0 1,252 9/3/2016