It seems that the protocol for Nativemessaging entails that the native App communicate with the extension via blocking read-then-write loop.
Firstly, is that correct?
If so, that makes it pretty hard to establish bidirectional asynchronous communications between the two sides.
Before I go doing something stupidly complicated to work around this limitation, is there some simple API to achieve bidirectional async messaging with native apps?
Things I'd like to support:
- Connection-based Nativemessaging (i.e: long running)
- Requests from either end with async responses
- Notifications from either end without responses
My first 'stupidly complicated' thought to achieve this is to:
- use Nativemessaging to launch the native app and manage its lifetime
- on startup have the native app launch a WebSocket server and respond to the first request with a WebSocket URI to be used by the Webextension from therein