OutWit.Communication.Client 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package OutWit.Communication.Client --version 1.0.0                
NuGet\Install-Package OutWit.Communication.Client -Version 1.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="OutWit.Communication.Client" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OutWit.Communication.Client --version 1.0.0                
#r "nuget: OutWit.Communication.Client, 1.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 OutWit.Communication.Client as a Cake Addin
#addin nuget:?package=OutWit.Communication.Client&version=1.0.0

// Install OutWit.Communication.Client as a Cake Tool
#tool nuget:?package=OutWit.Communication.Client&version=1.0.0                

OutWit.Communication.Client

Overview

The OutWit.Communication.Client library provides a robust framework for client-side communication in the WitCom ecosystem. With features like encryption, token-based authorization, and flexible serialization, it enables secure and efficient communication with WitCom servers.

Features

1. Authorization

  • AccessTokenProviderPlain: No token, suitable for public or unauthenticated scenarios.
  • AccessTokenProviderStatic: Static token for secure, predefined access.
Example:
var client = WitComClientBuilder.Build(options =>
{
    options.WithAccessToken("your-access-token");
});

2. Encryption

  • EncryptorClientPlain: No encryption for lightweight communication.
  • EncryptorClientGeneral: RSA/AES encryption for secure data exchange.
Example:
var client = WitComClientBuilder.Build(options =>
{
    options.WithEncryption();
});

3. Serialization

  • JSON: Default format, ideal for debugging and compatibility.
  • MessagePack: High-performance, compact binary serialization.
Example:
var client = WitComClientBuilder.Build(options =>
{
    options.WithJson();
});

// Or for MessagePack:
var client = WitComClientBuilder.Build(options =>
{
    options.WithMessagePack();
});

4. Logging and Debugging

Integrate custom logging for debugging and monitoring:

var client = WitComClientBuilder.Build(options =>
{
    options.WithLogger(new ConsoleLogger());
});

5. Timeout Configuration

Set request and response timeouts for client operations:

var client = WitComClientBuilder.Build(options =>
{
    options.WithTimeout(TimeSpan.FromSeconds(30));
});

6. Proxy for Services

Automatically generates a proxy to interact with server-side services using interfaces:

var service = client.GetService<IMyService>();
service.SomeMethod();

Installation

Install the package via NuGet. Note: You also need to install the specific transport package you intend to use (e.g., OutWit.Communication.Client.Tcp, OutWit.Communication.Client.WebSocket, etc.):

Install-Package OutWit.Communication.Client

Getting Started

Basic Setup

var client = WitComClientBuilder.Build(options =>
{
    options.WithAccessToken("my-access-token");
    options.WithEncryption();
    options.WithJson();
    options.WithTimeout(TimeSpan.FromSeconds(10));
});

await client.ConnectAsync(TimeSpan.FromSeconds(5), CancellationToken.None);

Sending Requests

var request = new WitComRequest
{
    MethodName = "MyMethod",
    Parameters = new object[] { 1, "parameter" }
};

var response = await client.SendRequest(request);
Console.WriteLine(response.Status);

Handling Events

The client supports events for callbacks and disconnections:

client.CallbackReceived += request =>
{
    Console.WriteLine("Callback received!");
};

client.Disconnected += _ =>
{
    Console.WriteLine("Disconnected from server");
};

API Reference

WitComClient

The core class for client-side communication.

Key Methods:
  • ConnectAsync: Establishes a connection to the server.
  • SendRequest: Sends a request and receives a response.
  • GetService: Generates a client-side proxy for a server-side service.
Events:
  • CallbackReceived: Triggered when a server callback is received.
  • Disconnected: Triggered when the client disconnects from the server.

WitComClientBuilder

A fluent API for configuring and creating WitComClient instances.

Configuration Options:
  • .WithAccessToken: Sets the access token for authentication.
  • .WithEncryption: Enables encryption for secure communication.
  • .WithJson: Configures JSON serialization.
  • .WithMessagePack: Configures MessagePack serialization.
  • .WithTimeout: Sets the timeout duration.
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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.  net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on OutWit.Communication.Client:

Package Downloads
OutWit.Communication.Client.Tcp

TCP client transport for WitCom - OutWit.Communication - the easiest and most natural way to communicate with .Net processes/services/clients.

OutWit.Communication.Client.WebSocket

Web Socket client transport for WitCom - OutWit.Communication - the easiest and most natural way to communicate with .Net processes/services/clients.

OutWit.Communication.Client.MMF

Memory Mapped File client transport for WitCom - OutWit.Communication - the easiest and most natural way to communicate with .Net processes/services/clients.

OutWit.Communication.Client.Pipes

Named Pipe client transport for WitCom - OutWit.Communication - the easiest and most natural way to communicate with .Net processes/services/clients.

OutWit.InterProcess.Host

Inter Process Host logic

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 117 2/1/2025
1.1.0 91 1/25/2025
1.0.2 133 1/11/2025
1.0.0 143 1/2/2025