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
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Undecided
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...

https://developer.chrome.com/extensions/nativeMessaging
https://wiki.mozilla.org/WebExtensions/Native_Messaging

Work in progress:

http://git.evergreen-ils.org/?p=working/Hatch.git;a=shortlog;h=refs/heads/collab/berick/native-messaging-host

Bill Erickson (berick) wrote :

Webstaff bits updated here:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1640255-hatch-native-messaging

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:

http://git.evergreen-ils.org/?p=working/Hatch.git;a=blob;f=INSTALL.adoc;hb=refs/heads/collab/berick/native-messaging-host

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

https://gist.github.com/berick/c981a7da5683a74478d8afce77c02d27

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.

TODO:

* 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:

http://git.evergreen-ils.org/?p=working/Hatch.git;a=shortlog;h=refs/heads/collab/berick/native-messaging-host-declarative

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1640255-hatch-native-messaging-declarative

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