Skip to content

DebugSession listens to events instead of just sending events #1804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 1, 2022

Conversation

elliette
Copy link
Contributor

Small refactor of the DebugSession:

  • it both listens to and sends events to the SSE/WS connection
  • it can send any event, not just ExtensionEvents

Copy link
Contributor

@annagrin annagrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with comments

final tabUrl = await _getTabUrl(dartAppTabId);
// Send a DevtoolsRequest to the event stream:
final event = jsonEncode(serializers.serialize(DevToolsRequest((b) => b
debugSession.sendEvent<DevToolsRequest>(DevToolsRequest((b) => b
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: do you need to specify the type parameter here? I thought debugSession.sendEvent(DevToolsRequest... should work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, done!

@@ -208,7 +208,7 @@ void _forwardChromeDebuggerEventToDwds(
if (method == 'Debugger.scriptParsed') {
debugSession.sendBatchedEvent(event);
} else {
debugSession.sendEvent(event);
debugSession.sendEvent<ExtensionEvent>(event);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here and in other places

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@elliette elliette merged commit ba5e3ec into dart-lang:master Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants