Hatch as browser native messaging host

Bug #1640255 reported by Bill Erickson on 2016-11-08
This bug report is a duplicate of:  Bug #1646166: Hatch 2.12 Omnibus. Edit Remove
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bill Erickson

Bug Description

Teach Hatch to act as a browser Native Messaging request handler. This lets us run and communicate w/ Hatch via browser extension via STDIO instead of WebSockets, obviating the need for Jetty, SSL certificates (valid or otherwise), and the specter of a disappearing websockets-on-localhost option.

More discussion to follow. In the meantime...


Work in progress:


Bill Erickson (berick) wrote :

Webstaff bits updated here:


Using the 2 branches listed in this bug, I'm able to communicate w/ Hatch via Native Messaging using the same API as before. Initial tests show printing to be more stable with the Hatch internals overhaul.

TODO: how-to docs so others can experiment.

Bill Erickson (berick) wrote :

Developer install documentation for Hatch + Native Messaging on Linux pushed to Hatching working repo:


Here's a gist of the compiled asciidoc file for review:


Both of the above branches have to be running for it all to work. Comments, questions, feedback appreciated.


As of today, Firefox does not support "externally_connectable" extensions, which means the code as written will not work with Firefox. There may be a workaround [http://stackoverflow.com/questions/10526995/can-a-site-invoke-a-browser-extension/10527809#10527809], but here's hoping FF gets that bit working sooner than later.

Bill Erickson (berick) wrote :

Pushed an addition to both branches to support allowing the browser to ask the extension if it's available. It uses sendMessage() to send a 'ping' request and get an immediate 'pong' response (or lack thereof) to determine if the connection is installed in the browser.

The previous code simply opened a port, which may never respond, which was an unreliable way to determine if the extension is available.

Note that I was having some trouble with the old web staff statusbar code when testing Hatch. Before testing, I recommend also merging the branch from bug #1564508.

Bill Erickson (berick) wrote :

More documentation and executable script updates pushed.

I have successfully installed and run native-messaging Hatch on 2 different Linux and 2 different Windows machines. Bi-direction Hatch communication is working as expected.


* Browser extension distribution
* Windows installer
 ** Installs Hatch Java bits (executable script, jars, logging.properties file)
 ** Installs browser native messaging host configs
 ** Offer to install JRE if JRE (8 or above) is not found

Bill Erickson (berick) wrote :

Updated version of above branches using declarativeContent to avoid the requirement of hard-coding allowed hosts in the extension manifest:



TODO: test on windows and review install docs

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers