LiteNetwork.Extensions.Processing 2.4.0

Suggested Alternatives

LiteNetwork.Extensions

dotnet add package LiteNetwork.Extensions.Processing --version 2.4.0                
NuGet\Install-Package LiteNetwork.Extensions.Processing -Version 2.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="LiteNetwork.Extensions.Processing" Version="2.4.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LiteNetwork.Extensions.Processing --version 2.4.0                
#r "nuget: LiteNetwork.Extensions.Processing, 2.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.
// Install LiteNetwork.Extensions.Processing as a Cake Addin
#addin nuget:?package=LiteNetwork.Extensions.Processing&version=2.4.0

// Install LiteNetwork.Extensions.Processing as a Cake Tool
#tool nuget:?package=LiteNetwork.Extensions.Processing&version=2.4.0                

LiteNetwork.Extensions

LiteNetwork is great, this repository aims to make it a little more awesome with some additional features.

Features

Simple Packet Handling

With LiteNetwork.Extensions you can easily send and receive packets via the packet handling feature. Setup is super simple, the steps are as follows:

  1. Initialize the packet handling feature via ILiteBuilder.UsePacketHandling().
  2. Specify what kind of serialization you want (currently only JSON is provided but you can implement your own via ILitePacketSerializer).
  3. Finally, for each packet you wish to handle register a packet handler via ILiteBuilder.RegisterPacketHandler<TPacket, TPacketHandler>()

Below, you'll find a simple example:

using LiteNetwork.Hosting;
using LiteNetwork.Server.Hosting;
using LiteNetwork.Extensions.Processing.Extensions;
using Microsoft.Extensions.Hosting;
using System;
using System.Threading.Tasks;

var host = new HostBuilder()
    // Configures the LiteNetwork context.
    .ConfigureLiteNetwork((context, builder) =>
    {
        // Add the server or client here...

        builder.UsePacketHandling();
        builder.UseJsonPacketSerialization();
        builder.RegisterPacketHandler<TestPacket, TestPacketHandler>();
    })
    .UseConsoleLifetime()
    .Build();

await host.RunAsync();

And of course, the packet and packet handler classes:

public class TestPacket
{
    public string SomeTestData { get; set; }
}

public class TestPacketHandler : LitePacketHandlerBase<TestPacket>
{
    protected override async Task Handle(TPacket packet, ILitePacketContext context)
    {
        // Run CPU bound if you like.
        await Task.Run(() =>
        {
            Console.WriteLine(packet.SomeTestData);

            // Now let's send a response.
            context.Send(new TestPacket()
            {
                SomeTestData = "LiteNetwork is Awesome!",
            });
        });
    }
}

Build Instructions

Below is a list of prerequisites and build instructions.

Prerequisites

Building on Windows, Mac, and Linux

  1. Download or clone the repository.
  2. Open LiteNetwork.Extensions.sln in your preferred IDE.
  3. Build the solution (or use dotnet build).

Download

  • Release builds will be accessible on GitHub and as NuGet packages.
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. 
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
2.4.0 171 1/23/2024 2.4.0 is deprecated because it is no longer maintained.

Initial Release