I'm currently developing a chrome extension that is mainly driven by a JS application. I'm able to send message between application and background page using long-lived connection until I reload the extension. Once it's reloaded, there is no way to connect to it (either from a content script or from the JS code using the extension ID). It keeps saying "Attemptin to use a disconnected port object". I tried switching to a one-time requests model, with no luck. After reloading the extension, the sendMessage callback is called without argument and the extension receives no message. I followed hints in this solution : chrome.runtime.sendMessage throws exception from content script after reloading Chrome Extension But it doesn't change anything.
What am I missing on this ?
Edit:
Here is how I set up the connection:
var port = chrome.runtime.connect()
// Then I use a DOM message to communicate with content-script :
window.addEventListener("message", function(message) {
port.postMessage(message);
}