LfrlAnvil.MessageBroker.Client 0.4.0

dotnet add package LfrlAnvil.MessageBroker.Client --version 0.4.0
                    
NuGet\Install-Package LfrlAnvil.MessageBroker.Client -Version 0.4.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="LfrlAnvil.MessageBroker.Client" Version="0.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LfrlAnvil.MessageBroker.Client" Version="0.4.0" />
                    
Directory.Packages.props
<PackageReference Include="LfrlAnvil.MessageBroker.Client" />
                    
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 LfrlAnvil.MessageBroker.Client --version 0.4.0
                    
#r "nuget: LfrlAnvil.MessageBroker.Client, 0.4.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 LfrlAnvil.MessageBroker.Client@0.4.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=LfrlAnvil.MessageBroker.Client&version=0.4.0
                    
Install as a Cake Addin
#tool nuget:?package=LfrlAnvil.MessageBroker.Client&version=0.4.0
                    
Install as a Cake Tool

(root) NuGet Badge

<img src="../../../../assets/logo.png" alt="logo" height="80"/> LfrlAnvil.MessageBroker.Core

This project contains client-side message broker implementation.

Documentation

Technical documentation can be found here.

Examples

Following is an example of creating a client and interacting with the server:

// create a client with 'my-client' name
// see 'MessageBrokerClientOptions' for available options
IPEndPoint serverEndpoint = ...;
var client = new MessageBrokerClient(
    serverEndpoint,
    "my-client",
    MessageBrokerClientOptions.Default );

// starts the client and connects to the server
await client.StartAsync();

// binds a message publisher to the 'foo' channel
var publisher = (await client.Publishers.BindAsync( "foo" ))
    .GetValueOrThrow()!.Value
    .Publisher;

// binds a message listener to the 'foo' channel
// see 'MessageBrokerListenerOptions' for available options
var listener = (await client.Listeners.BindAsync(
        "foo",
        (args, ct) =>
        {
            // callback invoked when a message intended for this listener arrives from the server
            // args also allows to easily send either an ACK or a NACK, if enabled
            // or 'SendMessageAckAsync' and 'SendNegativeMessageAckAsync' listener methods can be used instead
            Console.WriteLine( args.ToString() );
            return ValueTask.CompletedTask;
        },
        MessageBrokerListenerOptions.Default ))
    .GetValueOrThrow()!.Value
    .Listener;

// pushes a message to the 'foo' channel
// for more efficient memory-wise message pushing, see 'GetPushContext' method
await publisher.PushAsync( new byte[] { 1, 2, 3 } );

// unbinds the publisher from the channel
await publisher.UnbindAsync();

// unbinds the listener from the channel
await listener.UnbindAsync();

// closes the connection to the server and disposes the client
await client.DisposeAsync();
Product Compatible and additional computed target framework versions.
.NET 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 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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
0.4.0 125 3/14/2026