OutWit.Communication.Server 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package OutWit.Communication.Server --version 1.0.0                
NuGet\Install-Package OutWit.Communication.Server -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.Server" 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.Server --version 1.0.0                
#r "nuget: OutWit.Communication.Server, 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.Server as a Cake Addin
#addin nuget:?package=OutWit.Communication.Server&version=1.0.0

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

OutWit.Communication.Server

Overview

The OutWit.Communication.Server library provides a powerful framework for creating servers in the WitCom ecosystem. It supports encryption, token-based authorization, and flexible serialization to ensure secure and efficient communication with clients.

Features

1. Authorization

  • AccessTokenValidatorPlain: No token validation for unauthenticated scenarios.
  • AccessTokenValidatorStatic: Static token validation for predefined secure access.
Example:
var server = WitComServerBuilder.Build(options =>
{
    options.WithAccessToken("your-access-token");
});

2. Encryption

  • EncryptorServerPlain: No encryption for lightweight communication.
  • EncryptorServerGeneral: AES encryption for secure data exchange.
Example:
var server = WitComServerBuilder.Build(options =>
{
    options.WithEncryption();
});

3. Serialization

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

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

4. Logging and Debugging

Integrate custom logging for debugging and monitoring:

var server = WitComServerBuilder.Build(options =>
{
    options.WithLogger(new ConsoleLogger());
});

5. Timeout Configuration

Set request and response timeouts for server operations:

var server = WitComServerBuilder.Build(options =>
{
    options.WithTimeout(TimeSpan.FromSeconds(30));
});

6. Service Support

Expose your services seamlessly using the WithService configuration.

Example:
var server = WitComServerBuilder.Build(options =>
{
    options.WithService(new MyService());
});

Installation

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

Install-Package OutWit.Communication.Server

Getting Started

Basic Setup

var server = WitComServerBuilder.Build(options =>
{
    options.WithAccessToken("my-access-token");
    options.WithEncryption();
    options.WithJson();
    options.WithTimeout(TimeSpan.FromSeconds(10));
    options.WithService(new MyService());
});

server.StartWaitingForConnection();

Stopping the Server

server.StopWaitingForConnection();

Handling Requests

Define your service to process client requests:

public class MyService
{
    public string Greet(string name)
    {
        return $"Hello, {name}!";
    }
}

Clients can invoke this service:

var request = new WitComRequest
{
    MethodName = "Greet",
    Parameters = new object[] { "John" }
};

API Reference

WitComServer

The core class for server-side communication.

Key Methods:
  • StartWaitingForConnection: Begins listening for client connections.
  • StopWaitingForConnection: Stops the server and releases resources.

WitComServerBuilder

A fluent API for configuring and creating WitComServer 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.
  • .WithService: Exposes a service for client requests.
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 (6)

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

Package Downloads
OutWit.Communication.Server.WebSocket

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

OutWit.Communication.Server.MMF

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

OutWit.Communication.Server.Pipes

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

OutWit.Communication.Server.Tcp

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

OutWit.Communication.Server.Rest

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

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 78 2/1/2025
1.1.0 106 1/25/2025
1.0.2 90 1/11/2025
1.0.0 145 1/2/2025