We have a Firefox extension which communicates to a native messaging host declared in its manifest. We’ve noticed one weird moment about how the browser sends messages to the native host. For some reason, it spawns a new process for each new message. Is that expected behavior?
The flow looks something like this on the extension side:
- background script initiates port by calling “browser.runtime.connectNative”
- native messaging host process starts up
- and then the extension uses “browser.runtime.sendNativeMessage” to send messages. Each of these calls result in a new native host process (with a new uid, this is occurring on macOS).
Is this supposed to happen or it it possible to send messages to the existing instance on native messaging host?
This is mainly a concern for optimization. not to start all the routines on the native messaging host side.