{"id":21293216,"url":"https://github.com/guest271314/nativemessaginghosts","last_synced_at":"2026-03-16T21:04:08.689Z","repository":{"id":171803595,"uuid":"648430548","full_name":"guest271314/NativeMessagingHosts","owner":"guest271314","description":"Native Messaging hosts","archived":false,"fork":false,"pushed_at":"2024-08-09T05:51:47.000Z","size":166,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-09T06:51:39.392Z","etag":null,"topics":["native-messaging","native-messaging-host"],"latest_commit_sha":null,"homepage":"","language":"WebAssembly","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guest271314.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-02T00:45:02.000Z","updated_at":"2024-08-09T05:51:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"569ac912-b476-4cd4-8b43-bc82f6915e21","html_url":"https://github.com/guest271314/NativeMessagingHosts","commit_stats":null,"previous_names":["guest271314/nativemessaginghosts"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guest271314%2FNativeMessagingHosts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guest271314%2FNativeMessagingHosts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guest271314%2FNativeMessagingHosts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guest271314%2FNativeMessagingHosts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guest271314","download_url":"https://codeload.github.com/guest271314/NativeMessagingHosts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225741166,"owners_count":17516895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["native-messaging","native-messaging-host"],"created_at":"2024-11-21T13:53:45.873Z","updated_at":"2026-03-16T21:04:08.684Z","avatar_url":"https://github.com/guest271314.png","language":"WebAssembly","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NativeMessagingHosts\n\n- Python\n- C\n- C++\n- QuickJS\n- txiki.js\n- Node.js\n- Deno\n- Bun\n- WebAssembly/WAT/WASI (C, C++, AssemblyScript, Bytecode Alliance Javy, Rust)\n- Bash\n- SpiderMonkey `js` shell\n- V8 `d8` shell\n- TypeScript\n- Amazon Web Services - Labs LLRT (Low Latency Runtime)\n- Rust\n- `tee` command (Busybox; GNU Coreutils)\n- Static Hermes\n- AssemblyScript\n- Bytecode Alliance Javy\n- Go\n- Zig\n- Lua\n\nTested echoing `new Array(209715)` (1 MB in JSON format) from client to host. \n\n# Native messaging documentation\n- [Chrome Developers](https://developer.chrome.com/docs/extensions/mv3/nativeMessaging/)\n- [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging)\n- [Microsoft Edge Developer documentation](https://learn.microsoft.com/en-us/microsoft-edge/extensions-chromium/developer-guide/native-messaging)\n- [Messaging between the app and JavaScript in a Safari web extension](https://developer.apple.com/documentation/safariservices/messaging-between-the-app-and-javascript-in-a-safari-web-extension)\n\n[Native messaging protocol](https://developer.chrome.com/docs/extensions/mv3/nativeMessaging/#native-messaging-host-protocol) (Chrome Developers)\n\n\u003e Chrome starts each native messaging host in a separate process and communicates with it using standard input (`stdin`) and standard output (`stdout`). The same format is used to send messages in both directions; each message is serialized using JSON, UTF-8 encoded and is preceded with 32-bit message length in native byte order. The maximum size of a single message from the native messaging host is 1 MB, mainly to protect Chrome from misbehaving native applications. The maximum size of the message sent to the native messaging host is 64 MiB.\n\u003e\n\u003e The first argument to the native messaging host is the origin of the caller, usually `chrome-extension://[ID of allowed extension]`. This allows native messaging hosts to identify the source of the message when multiple extensions are specified in the allowed_origins key in the [native messaging host manifest](https://developer.chrome.com/docs/extensions/develop/concepts/native-messaging#native-messaging-host).\n\n# Installation and usage\n\nInstallation and usage on Chrome and Chromium\n\n1. Navigate to `chrome://extensions`.\n2. Toggle `Developer mode`.\n3. Click `Load unpacked`.\n4. Select `native-messaging-\u003chost\u003e` folder, e.g., `native-messaging-c`.\n5. Note the generated extension ID.\n6. Open, for example, `nm_c.json` in a text editor, set `\"path\"` to absolute path of `nm_c.wasm` and `chrome-extension://\u003cID\u003e/` using ID from 5 in `\"allowed_origins\"` array. \n7. Copy the `nm_c.json` file to Chrome or Chromium configuration folder, e.g., Chromium on \\*nix `~/.config/chromium/NativeMessagingHosts`; Chrome dev channel on \\*nix `~/.config/google-chrome-unstable/NativeMessagingHosts`.\n8. Make sure `wasmtime` for WASM host, or the single host file, e.g. when using QuickJS `nm_qjs.js,` are executable.\n9. To test click `service worker` link in panel of unpacked extension which is DevTools for `background.js` in MV3 `ServiceWorker`, observe echo'ed message from Native Messaging host to client in  DevTools `console`. To disconnect run `port.disconnect()`.\n\nFor differences between OS and browser implementations see [Chrome incompatibilities](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Chrome_incompatibilities#native_messaging). For Firefox or Nightly usage see also [Can't get response in Ubuntu #506](https://github.com/mdn/webextensions-examples/issues/506).\n\n# Testing \n\n`nm_standalone_test.js` tests the Native Messaging hosts outside of the browser. Example usage\n\n```\ndeno -A nm_standalone_test.js ./nm_nodejs.js native-messaging-extension://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/\n```\n\n# Examples\n\n- Capture system and specific audio output, stream output to browser. [capture_system_audio](https://github.com/guest271314/captureSystemAudio/tree/master/native_messaging/capture_system_audio)\n- Send text or SSML to local eSpeak NG speech synthesis engine, stream output to browser [native-messaging-espeak-ng](https://github.com/guest271314/native-messaging-espeak-ng)\n- Turn local PHP server on and off from browser [native-messaging-php](https://github.com/guest271314/native-messaging-php), see also [`deno-server`](https://github.com/guest271314/native-messaging-espeak-ng/tree/deno-server) branch in `native-messaging-espeak-ng`\n- WAT embedded in a Bash shell script [nm_c_wat.sh](https://github.com/guest271314/native-messaging-webassembly/blob/main/nm_c_wat.sh) (see usage note at [10.](https://github.com/guest271314/native-messaging-webassembly#readme:~:text=for%20WAT%20embedded%20in%20nm_c_wat.sh%20we%20use%20kill_wasmtime.sh%20to%20terminate%20wasmtime%20using%20polling%20of%20nm_c_wat.sh%20because%20process%20substitution%20keeps%20wasmtime%20running%20after%20the%20Native%20Messaging%20host%20is%20disconnected%20and%20exits.))\n- Full duplex streaming from and to the browser over HTTP/2 with WHATWG  `fetch()` and Streams ([Deno](https://github.com/guest271314/native-messaging-deno/tree/fetch-duplex) version, [Node.js](https://github.com/guest271314/native-messaging-nodejs/blob/full-duplex/nm_nodejs.mjs) version)\n- `nm_host.js` and `nm_typescript.ts` (derived from `nm_host.js`) are intended to be JavaScript runtime agnostic, can be run by `node`, `deno`, and `bun`\n- `nm_bash_standalone.sh` does not use subshells\n- rhasspy/piper local TTS stream [native-messaging-piper](https://github.com/guest271314/native-messaging-piper)\n- JavaScript in WASM using Bytecode Alliance's Javy [nm_javy.js](https://github.com/guest271314/native-messaging-webassembly/blob/main/nm_javy.js), see [native-messaging-webassembly/README.md](https://github.com/guest271314/native-messaging-webassembly/blob/main/README.md)\n- Write files to local file system from Web pages [native-messaging-file-writer](https://github.com/guest271314/native-messaging-file-writer)\n\n# License\nDo What the Fuck You Want to Public License [WTFPLv2](http://www.wtfpl.net/about/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguest271314%2Fnativemessaginghosts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguest271314%2Fnativemessaginghosts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguest271314%2Fnativemessaginghosts/lists"}