I am working on a Chrome extension that uses a C++ Native Host. In a background.js script (persistent set to false), using chrome.onstartup event, I create the connection to the
When Chrome terminates or your extension is unloaded, it will send -1
message to your native messaging host. You will have to check for that value, assuming your native messaging host is written in C++ then this is what you should do:
int read_char = ::getchar();
if (read_char == -1) {
// Do termination work here...
}