ElectronCgi.DotNet 0.0.2

Electron CGI DotNet

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

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.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.0.2 313 3/20/2019
0.0.1 156 2/16/2019