Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ba32107/dotnet-chrome-native-messaging
Chrome Native Messaging Host libraries in .NET
https://github.com/ba32107/dotnet-chrome-native-messaging
chrome chrome-extension dotnet dotnet-standard
Last synced: 2 months ago
JSON representation
Chrome Native Messaging Host libraries in .NET
- Host: GitHub
- URL: https://github.com/ba32107/dotnet-chrome-native-messaging
- Owner: ba32107
- License: mit
- Created: 2019-12-25T15:40:52.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-05-31T21:22:50.000Z (over 1 year ago)
- Last Synced: 2023-05-31T23:03:46.425Z (over 1 year ago)
- Topics: chrome, chrome-extension, dotnet, dotnet-standard
- Language: C#
- Homepage:
- Size: 67.4 KB
- Stars: 19
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Chrome Native Messaging Host libraries in .NET
[
](https://www.nuget.org/packages/Chrome.NativeMessaging/)
[](#)
[](#)
[
](https://www.nuget.org/packages/Chrome.NativeMessaging.Installer/)
[](#)
[](#)
A simple and intuitive .NET implementation of the [Chrome Native Messaging](https://developer.chrome.com/apps/nativeMessaging) 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`:
```C#
var host = new NativeMessagingHost();
host.StartListening(jsonMessage =>
{
var response = DoSomethingAndCreateResponse(jsonMessage);
return response;
});
```To learn more, check out [the docs](https://github.com/ba32107/dotnet-chrome-native-messaging/blob/master/docs/Chrome.NativeMessaging.md) and the [Examples](https://github.com/ba32107/dotnet-chrome-native-messaging/blob/master/docs/Examples.md) page.
### Chrome.NativeMessaging.Installer
Use this package to install your native messaging host. Just create a manifest and let the library do the rest:
```C#
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](https://github.com/ba32107/dotnet-chrome-native-messaging/blob/master/docs/Chrome.NativeMessaging.Installer.md) to learn more.