Skip to content

Create communication channel so Editor can talk to pub serve #13901

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

Closed
munificent opened this issue Oct 8, 2013 · 12 comments
Closed

Create communication channel so Editor can talk to pub serve #13901

munificent opened this issue Oct 8, 2013 · 12 comments
Assignees
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-enhancement A request for a change that isn't a bug
Milestone

Comments

@munificent
Copy link
Member

To get the Editor hosting the pub dev server, it needs to be able to map from URIs coming from Dartium (which in turn come from the dev server) to file paths in the users workspace (and vice versa).

The Editor currently has its own implementation of that mapping. Since pub serve allows arbitrary transformations of files, it will have to ask pub for this. The basic idea is that the Editor can ask the running pub process "which file corresponds to this URI?" (and vice versa).

We can do this either as an HTTP API that the running pub process responds to (likely on a different port from the actual served app) or using stdin/stdout. I think the pub team is leaning towards HTTP, but we can do either.

@munificent
Copy link
Member Author

Added this to the M8 milestone.

@nex3
Copy link
Member

nex3 commented Oct 8, 2013

I'd like to hear more about what the URI mapping will be used for. This sort of mapping isn't necessarily straightforward -- for example, a JS file created by dart2js will have different sections that come from many different files. Barback can track information about the "primary" input (in the case of dart2js, this would be the entrypoint containing [main])... is that sufficient for the editor's use cases?

@keertip
Copy link
Contributor

keertip commented Oct 8, 2013

For starters, the URI mapping would be used to set breakpoints in Dartium. Take the case of user launching todomvc from the editor, sets breakpoint in todomvc-2/web/model.dart

launch url : http://127.0.0.1:3030/todomvc-2/web/index.html
breakpoint location: todomvc-2/web/model.dart:21
GET request is for : /todomvc-2/web/model.dart

and when stopped at breakpoint, script url sent to editor is http://127.0.0.1:3030/todomvc-2/web/model.dart

In the case of pub serve, the editor would ask pub to translate todomvc-2/web/model.dart to a location which dartium can understand when served by pub and on the pause ask pub to map it back to a url that editor could understand.

Does that make sense?

 

@nex3
Copy link
Member

nex3 commented Oct 8, 2013

Yes, although setting breakpoints in the presence of transformers will require much more advanced capabilities than just a URL mapping.

@devoncarew
Copy link
Member

We can do this either as an HTTP API that the running pub process responds to (likely on a different port from the actual served app) or using stdin/stdout.

I think another good option would be to use websockets. It's how we talk to Dartium. Essentially, the server that's also serving http traffic on port 1234 can act as a websocket server on the same port. So, no second port necessary, and we get a nice, structured protocol with push notifications.

That said, I'm not sure about the support for websocket servers in the dart:io library.

@munificent
Copy link
Member Author

That said, I'm not sure about the support for websocket servers in the dart:io library.

I think Seth has experience there, I'll talk to him about it.

@devoncarew
Copy link
Member

There's a bit more info here:

http://api.dartlang.org/docs/releases/latest/dart_io/WebSocketTransformer.html

Looks like it's supported.

@munificent
Copy link
Member Author

Set owner to @munificent.
Added Started label.

@nex3
Copy link
Member

nex3 commented Oct 8, 2013

I'm edgy about using WebSockets just because it's a new corner of dart:io that we haven't used yet, and historically those end up coming with a lot of pain.

@munificent
Copy link
Member Author

Marked this as blocking #13935.

@munificent
Copy link
Member Author

@munificent munificent added Type-Enhancement P1 A high priority bug; for example, a single project is unusable or has many test failures labels Oct 16, 2013
@munificent munificent self-assigned this Oct 16, 2013
@munificent munificent added this to the M8 milestone Oct 16, 2013
@DartBot
Copy link

DartBot commented Jun 5, 2015

This issue has been moved to dart-lang/pub#657.

@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

6 participants