Skip to content

Chrome Native Messaging Host libraries in .NET

License

Notifications You must be signed in to change notification settings

ba32107/dotnet-chrome-native-messaging

Repository files navigation

Chrome Native Messaging Host libraries in .NET

A simple and intuitive .NET implementation of the Chrome Native Messaging protocol.

  • Easy to use
  • No JSON parsing or dependencies
  • .NET Standard & platform independent
  • Testable through abstractions
  • Async support
  • Separate installer library
  • NuGet packages available

Chrome.NativeMessaging

Creating a native messaging host is dead simple: just call StartListening and pass in your message handler as a Func<string, string>:

var host = new NativeMessagingHost();
host.StartListening(jsonMessage =>
{
    var response = DoSomethingAndCreateResponse(jsonMessage);
    return response;
});

To learn more, check out the docs and the Examples page.

Chrome.NativeMessaging.Installer

Use this package to install your native messaging host. Just create a manifest and let the library do the rest:

var manifest = new NativeMessagingHostManifest
{
    Name = "com.my_company.my_application",
    Description = "My Application",
    Path = @"C:\Program Files\My Application\chrome_native_messaging_host.exe",
    AllowedOrigins = new []
    {
        "knldjmfmopnpolahpmmgbagdohdnhkik"
    }
};

// System.IO.Abstractions
var fs = new FileSystem();

var installer = NativeMessagingHostInstallerFactory.CreateInstaller(fs);
installer.Install(manifest);

Read the docs to learn more.

About

Chrome Native Messaging Host libraries in .NET

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages