https://github.com/guest271314/native-messaging-cpp
C++ Native Messaging host.
https://github.com/guest271314/native-messaging-cpp
cpp native-messaging native-messaging-host
Last synced: 4 months ago
JSON representation
C++ Native Messaging host.
- Host: GitHub
- URL: https://github.com/guest271314/native-messaging-cpp
- Owner: guest271314
- Created: 2022-05-01T13:06:28.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-07T04:59:49.000Z (over 3 years ago)
- Last Synced: 2025-04-21T16:13:27.462Z (about 1 year ago)
- Topics: cpp, native-messaging, native-messaging-host
- Language: C++
- Homepage:
- Size: 10.7 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
C++ Native Messaging host
Installation and usage on Chrome and Chromium
1. Navigate to `chrome://extensions`.
2. Toggle `Developer mode`.
3. Click `Load unpacked`.
4. Select `native-messaging-cpp` folder.
5. Note the generated extension ID.
6. Compile with `clang++ -std=c++20 nm_cpp.cpp -o nm_cpp` or `g++ -std=c++20 nm_cpp.cpp -o nm_cpp`.
7. Open `nm_cpp.json` in a text editor, set `"path"` to absolute path of `nm_cpp` and `chrome-extension:///` using ID from 5 in `"allowed_origins"` array.
8. Copy the `nm_cpp.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`.
9. 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 Node.js 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/)