C Native Messaging host
Installation and usage on Chrome and Chromium
- Navigate to
chrome://extensions. - Toggle
Developer mode. - Click
Load unpacked. - Select
native-messaging-cfolder. - Note the generated extension ID.
- Compile with
clang nm_c.c -o nm_corgcc nm_c.c -o nm_c. - Open
nm_c.jsonin a text editor, set"path"to absolute path ofnm_candchrome-extension://<ID>/using ID from 5 in"allowed_origins"array. - Copy the
nm_c.jsonfile to Chrome or Chromium configuration folder, e.g., Chromium on *nix~/.config/chromium/NativeMessagingHosts; Chrome dev channel on *nix~/.config/google-chrome-unstable/NativeMessagingHosts. - To test click
service workerlink in panel of unpacked extension which is DevTools forbackground.jsin MV3ServiceWorker, observe echo'ed message from Node.js Native Messaging host. To disconnect runport.disconnect().
The Native Messaging host echoes back the message passed.
For differences between OS and browser implementations see Chrome incompatibilities.
Do What the Fuck You Want to Public License WTFPLv2