ElectronCgi.DotNet 0.0.1

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.1
dotnet add package ElectronCgi.DotNet --version 0.0.1
<PackageReference Include="ElectronCgi.DotNet" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ElectronCgi.DotNet --version 0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Find More information about ElectronCGI here.
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.
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();        
}

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.0.2 445 3/20/2019
0.0.1 173 2/16/2019