Reputation: 366
Is it possible to send message from chrome extension to a launch agent or to a daemon in mac ?
Upvotes: 0
Views: 49
Reputation: 3053
Yes, it is possible.
The important aspect for a launch agent is that it should be started before the messages are sent.
This means, that you should never use the chrome.runtime.sendNativeMessage()
function over first creating the port
with chrome.runtime.connectNative()
and calling port.postMessage()
.
As per the documentation:
When a messaging port is created using runtime.connectNative() Chrome starts native messaging host process and keeps it running until the port is destroyed. On the other hand, when a message is sent using runtime.sendNativeMessage(), without creating a messaging port, Chrome starts a new native messaging host process for each message.
Upvotes: 0