ElectronCgi.DotNet 0.0.2

Package to enable connection .Net with Node applications through the electron-cgi npm package

There is a newer version of this package available.
See the version list below for details.
Install-Package ElectronCgi.DotNet -Version 0.0.2
dotnet add package ElectronCgi.DotNet --version 0.0.2
<PackageReference Include="ElectronCgi.DotNet" Version="0.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ElectronCgi.DotNet --version 0.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Find More information about ElectronCGI here.

New in Version 0.0.2: Added ability to serve requests concurrently using System.Threading.Tasks.DataFlow

Usage:

In NodeJs/Electron:

const { ConnectionBuilder } = require('electron-cgi');

const connection = new ConnectionBuilder()
        .connectTo('dotnet', 'run', '--project', 'DotNetConsoleProjectWithElectronCgi.DotnetPackage')
        .build();

connection.onDisconnect = () => {
    console.log('Lost connection to the .Net process');
};

connection.send('greeting', 'John', theGreeting => {
    console.log(theGreeting); // will print "Hello John!"
});

connection.close();

And in the .Net Console Application:

using ElectronCgi.DotNet;

//...
static void Main(string[] args)
{
    var connection = new ConnectionBuilder()
                        .WithLogging()
                        .Build();

    // expects a request named "greeting" with a string argument and returns a string
    connection.On<string, string>("greeting", name =>
    {
        return $"Hello {name}!";
    });

    // wait for incoming requests
    connection.Listen();        
}

Find More information about ElectronCGI here.

New in Version 0.0.2: Added ability to serve requests concurrently using System.Threading.Tasks.DataFlow

Usage:

In NodeJs/Electron:

const { ConnectionBuilder } = require('electron-cgi');

const connection = new ConnectionBuilder()
        .connectTo('dotnet', 'run', '--project', 'DotNetConsoleProjectWithElectronCgi.DotnetPackage')
        .build();

connection.onDisconnect = () => {
    console.log('Lost connection to the .Net process');
};

connection.send('greeting', 'John', theGreeting => {
    console.log(theGreeting); // will print "Hello John!"
});

connection.close();

And in the .Net Console Application:

using ElectronCgi.DotNet;

//...
static void Main(string[] args)
{
    var connection = new ConnectionBuilder()
                        .WithLogging()
                        .Build();

    // expects a request named "greeting" with a string argument and returns a string
    connection.On<string, string>("greeting", name =>
    {
        return $"Hello {name}!";
    });

    // wait for incoming requests
    connection.Listen();        
}

Release Notes

Added the ability to serve requests concurrently.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.3 198 6/15/2020
1.0.2 164 5/31/2020
1.0.1 717 3/9/2020
1.0.0 102 3/5/2020
0.0.5 711 11/25/2019
0.0.2 944 3/20/2019
0.0.1 407 2/16/2019
Show less