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
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.
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.