Amazon Web Services - Labs LLRT (Low Latency Runtime) Native Messaging host
Installation and usage on Chrome and Chromium
-
Navigate to
chrome://extensions
. -
Toggle
Developer mode
. -
Click
Load unpacked
. -
Select
native-messaging-llrt
folder. -
Note the generated extension ID.
-
Open
nm_llrt.json
in a text editor, set"path"
to absolute path ofnm_llrt.js
andchrome-extension://<ID>/
using ID from 5 in"allowed_origins"
array. -
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
; and similar for Chrome For Testing. -
Make sure
nm_llrt.js
is executable. See Notes for why Bash or QuickJS are used to read standard input stream tollrt
. -
To test click
service worker
link in panel of unpacked extension which is DevTools for background.js in MV3ServiceWorker
, observe echo'ed message fromllrt
Native Messaging host. The communication mechanism can be extended to runllrt
from any arbitrary Web page using various means, including, but not limited to utilizing"externally_connectable"
to message to and from theServiceWorker
on specific Web pages over IPC;"web_accessible_resources"
to append an extensioniframe
to any document and usepostMessage()
to transfer messages between browsing contexts; an offscreen document or side-panel document to connect to the host and transfer messages back and forth to the arbitrary Web page in the browser, et al.
Standard input and standard output are not specified by ECMA-262.
There does not appear to be a straigtforward way to read standard input to llrt
.
We use pgrep
command to get the PID of the current process, then or GNU Coreutils head
,
dd
command, or QuickJS to read /proc/$@/fd/0
, then echo the STDIN to the current llrt
process to llrt
.
For differences between OS and browser implementations see Chrome incompatibilities.
Do What the Fuck You Want to Public License WTFPLv2