https://github.com/guest271314/native-messaging-zig
Zig Native Messaging host
https://github.com/guest271314/native-messaging-zig
native-messaging native-messaging-host zig
Last synced: 7 days ago
JSON representation
Zig Native Messaging host
- Host: GitHub
- URL: https://github.com/guest271314/native-messaging-zig
- Owner: guest271314
- License: wtfpl
- Created: 2026-02-15T03:02:51.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-06-13T13:12:25.000Z (10 days ago)
- Last Synced: 2026-06-13T15:12:19.062Z (10 days ago)
- Topics: native-messaging, native-messaging-host, zig
- Language: Zig
- Homepage:
- Size: 32.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Zig Native Messaging host
### Compile
#### Executable
```bash
zig build-exe nm_zig.zig -O ReleaseSmall
```
#### wasm32-wasi
```bash
zig build-exe nm_zig.zig -target wasm32-wasi -O ReleaseSmall
```
### Installation and usage on Chrome and Chromium
1. Navigate to `chrome://extensions`.
2. Toggle `Developer mode`.
3. Click `Load unpacked`.
4. Select `native-messaging-zig` folder.
5. Note the generated extension ID.
6. Open `nm_zig.json` in a text editor, set `"path"` to absolute path of `nm_zig` (or `nm_zig.sh` marked executable to use `zig run` to "Create executable and run immediately"; or mark `nm_zig.zig` as executable and set `"path"` to `nm-zig.zig`) and `chrome-extension:///` using ID from 5 in `"allowed_origins"` array.
7. Copy the 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`.
8. 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 Zig Native Messaging host. To disconnect run `port.disconnect()`.
The Native Messaging host echoes back the message passed.
For differences between OS and browser implementations see [Chrome incompatibilities](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Chrome_incompatibilities#native_messaging).
## License
Do What the Fuck You Want to Public License [WTFPLv2](http://www.wtfpl.net/about/)