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
Ok, some extension exploration with @wch revealed that the problem is when your computer goes to sleep, chrome closes both the websocket and the corresponding debugging session. So to fix this problem you need to create a new websocket in the chromote object, something like this:
And then each session object really needs to be recreated. This is currently hard because the ChromoteSession object only tracks the transient session id, not the target id of the underlying tab/page that you need to recreate it.
A 100% automated fix for this is going to be quite a lot of work and will require time from the chromote team (which is not currently possible as they're working on other things). So in the meantime, I'm going to create the tooling that will allow you to fix this yourself:
Extract out the code above into a chromote$reconnect() function.
Store the target id in the ChromoteSession so it's possible to recreate a new debugging session for an existing target. (We can then use this in a bunch of the other methods as a small performance optimisation).
Create a way to detect this from both Chromote and ChromoteSession, probably by checking the $readyState of the underlying websocket in Chromote, and then in ChromoteSession also checking that the parent is active.
Activity
tom-parkinson commentedon Feb 10, 2023
I see the same issue routinely, also. It seems to hold up Chrome browser processes, too.
JakeNel28 commentedon Jan 22, 2024
Recently started using this package, and this happens a lot to me.
hadley commentedon Jan 25, 2024
I happened to have a chrome session open on the page, and saw this:
So possibly there's some timeout that leads to devtools shutting down?
hadley commentedon Jan 25, 2024
When this happens you can fix it with:
Possibly useful, this gives you the error stream:
hadley commentedon Jan 29, 2024
Ok, some extension exploration with @wch revealed that the problem is when your computer goes to sleep, chrome closes both the websocket and the corresponding debugging session. So to fix this problem you need to create a new websocket in the chromote object, something like this:
And then each session object really needs to be recreated. This is currently hard because the ChromoteSession object only tracks the transient session id, not the target id of the underlying tab/page that you need to recreate it.
A 100% automated fix for this is going to be quite a lot of work and will require time from the chromote team (which is not currently possible as they're working on other things). So in the meantime, I'm going to create the tooling that will allow you to fix this yourself:
chromote$reconnect()function.$readyStateof the underlying websocket in Chromote, and then in ChromoteSession also checking that the parent is active.Record the target id in a session
Check that a chromote connection is alive
Extract out connection code into own method
[-]Time out while creating session[/-][+]Session dies after computer goes to sleep[/+]Record the target id in a session (#135)
Implement ChromoteSession$respawn()
Extract out connection code into own method (#137)
Implement `ChromoteSession$respawn()` & refactor session creation (#139)
Check that a chromote connection is alive (#136)
hadley commentedon Feb 2, 2024
The Chromote object will now restart, and ChromoteSessions will tell you to call
$respawn()to get a new debugging session for an existing target.