CodeWF.EventBus.Socket 1.2.0

dotnet add package CodeWF.EventBus.Socket --version 1.2.0
                    
NuGet\Install-Package CodeWF.EventBus.Socket -Version 1.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="CodeWF.EventBus.Socket" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeWF.EventBus.Socket" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="CodeWF.EventBus.Socket" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CodeWF.EventBus.Socket --version 1.2.0
                    
#r "nuget: CodeWF.EventBus.Socket, 1.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.
#:package CodeWF.EventBus.Socket@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CodeWF.EventBus.Socket&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=CodeWF.EventBus.Socket&version=1.2.0
                    
Install as a Cake Tool

CodeWF.EventBus.Socket

English | 简体中文

NuGet NuGet License

CodeWF.EventBus.Socket is a lightweight TCP event bus for C# processes. It provides Publish/Subscribe messaging and Query-style request/response over sockets, so local processes or lightweight services can communicate without introducing RabbitMQ, Kafka, Redis, or other external MQ infrastructure.

Command

Query

Highlights

  • TCP socket transport based on CodeWF.NetWrapper
  • Publish/Subscribe for cross-process notifications
  • Query/response flow on the same subject
  • Query correlation by request TaskId, including concurrent queries on the same subject
  • Reuses CodeWF.NetWrapper transport objects such as TcpSocketServer, TcpSocketClient, SocketCommand, and Heartbeat
  • No external MQ dependency
  • Demo application in src/EventBusDemo

Installation

dotnet add package CodeWF.EventBus.Socket

or

Install-Package CodeWF.EventBus.Socket

Quick Start

Start the server

using CodeWF.EventBus.Socket;

IEventServer eventServer = new EventServer();
await eventServer.StartAsync("127.0.0.1", 9100);

Connect a client

using CodeWF.EventBus.Socket;

IEventClient eventClient = new EventClient();
await eventClient.ConnectAsync("127.0.0.1", 9100);

Subscribe and publish

eventClient.Subscribe<NewEmailCommand>("event.email.new", command =>
{
    Console.WriteLine($"Received: {command.Subject}");
});

eventClient.Publish("event.email.new", new NewEmailCommand
{
    Subject = "Welcome",
    Content = "Your account is ready",
    SendTime = DateTime.Now
}, out _);

Query and respond

eventClient.Subscribe<EmailQuery>("event.email.query", query =>
{
    var response = new EmailQueryResponse
    {
        Emails = EmailManager.QueryEmail(query.Subject)
    };

    eventClient.Publish("event.email.query", response, out _);
});

var result = await eventClient.QueryAsync<EmailQuery, EmailQueryResponse>(
    "event.email.query",
    new EmailQuery { Subject = "Account" },
    3000);

Documentation

Communication Protocol

Data packets are exchanged over TCP.

Protocol Frame

Notes

  • This library is designed for lightweight event distribution and IPC-style communication.
  • The transport layer is implemented with CodeWF.NetWrapper, and same-name transport objects are reused directly instead of being duplicated locally.
  • Event-bus-specific request/query/update packets remain defined in this project because they carry library-specific semantics.
  • Messages are kept in memory only. There is no persistence, broker-side retry queue, or delivery guarantee after a process restart.
  • For production use, consider whether you need authentication, encryption, retry, monitoring, and back-pressure around the socket transport.
Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.2.0 104 4/26/2026
1.1.0 110 4/17/2026
1.0.0 127 2/13/2026
0.2.2 470 12/9/2025
0.2.1.1 273 2/17/2025
0.2.1 264 10/12/2024
0.2.0.1 198 9/4/2024
0.2.0 186 8/3/2024
0.1.0 170 8/3/2024
0.0.4 177 7/29/2024
0.0.3 175 7/27/2024
0.0.2 171 7/27/2024
0.0.1 130 7/27/2024