You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
in my website, connet to this extension, code as follow:
let port = chrome.runtime.connect(extensionId, { name: id });
this.port.onMessage.addListener((msg) => {
// handle msg
});
port.onDisconnect.addListener(() => {
// handle disconnect
});
See error
after several minutes(about 5-6 minutes),my website receive port disconnect
Expected behavior
port not disconnect, keep live connection
Additional context
when extension change to MV2, this bug not happen, it seems to be a bug in MV3
The text was updated successfully, but these errors were encountered:
Service workers in Chrome auto-disconnect any external connections such as extension ports after five minutes forcibly. This is a breaking change for thousands of extensions so it must be mentioned in the documentation. Ideally, though, this timer should not apply to extensions at all.
runtime.connect successfully, and postMessage a few times successfully. However, after 5 minutes, onDisconnect event triggered. Looks like automatically lost connection. I don't know what is the reason.
Describe the bug
when website connect to a chrome extension(use MV3),port disconnect after several minutes
To Reproduce
Steps to reproduce the behavior:
create a chrome extension use MV3, code as follow;
chrome.runtime.onConnectExternal.addListener((port) => {
add extension in chrome browser
in my website, connet to this extension, code as follow:
let port = chrome.runtime.connect(extensionId, { name: id });
this.port.onMessage.addListener((msg) => {
// handle msg
});
port.onDisconnect.addListener(() => {
// handle disconnect
});
See error
after several minutes(about 5-6 minutes),my website receive port disconnect
Expected behavior
port not disconnect, keep live connection
Additional context
when extension change to MV2, this bug not happen, it seems to be a bug in MV3
The text was updated successfully, but these errors were encountered: