Send an event notifying DWDS when the debugger is detached #1595
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Seems to resolve b/231336802
We can get in a weird state with the Dart Debug Extension. If a user starts debugging, and detaches the debugger by closing the banner added by Chrome, we close the SSE socket client.
However, from DWDS, there can be a substantial delay before the SSE socket stream receives the "done" event, and therefore closes the actual SSE connection (code).
If this done event is received AFTER the user has already starting debugging their application again, then we close their debug session while they are debugging.
It seems like this is resolved if we send an event to notify DWDS that the debugger has been detached, and call
close
in response to that event. I'm not sure why this stream event is received immediately, but the done event isn't.