Open Bug 1388899 Opened 7 years ago Updated 2 years ago

Expose a websocket server from `mach watch`

Categories

(Firefox Build System :: General, enhancement)

enhancement

Tracking

(firefox57 wontfix)

Tracking Status
firefox57 --- wontfix

People

(Reporter: bgrins, Unassigned)

References

(Blocks 1 open bug)

Details

If `mach watch` were to start a WebSocket server, then a running Firefox instance or some other tool could listen to it and be notified of source changes. This was started in Bug 1384241, but it was removed from scope there.

I can imagine multiple consumers of this, but the initial usecase that Nick and I have been working on is CSS hot reload for Firefox in local development, such that when you save a CSS file on disk the changes are immediately reflected in a running Firefox without any extra interaction.
The connection details could be passed into Firefox as an environment variable.

My preferred workflow would be a single command `./mach run --watch` that would start the file watcher, websocket server, and spawn Firefox with the correct environment variable, but that seems tricky and probably out of scope for this bug.
I agree `mach run --watch` is a nifty workflow!

I disagree that it is difficult to implement. The hacky way of doing it is to spawn a `mach watch` process from `mach run`. That process's lifetime is tied to `mach run`'s.

Ideally, yes, we run all the Python code in a single process. But if you are going to be introducing websocket servers, perhaps Python 3, etc, the subprocess is the way to go :)
(In reply to Gregory Szorc [:gps] from comment #2)
> I agree `mach run --watch` is a nifty workflow!
> 
> I disagree that it is difficult to implement. The hacky way of doing it is
> to spawn a `mach watch` process from `mach run`. That process's lifetime is
> tied to `mach run`'s.
>
> Ideally, yes, we run all the Python code in a single process. But if you are
> going to be introducing websocket servers, perhaps Python 3, etc, the
> subprocess is the way to go :)

That's great to hear! I will file a new bug for this
See Also: → 1388972
Blocks: 1389169
Product: Core → Firefox Build System
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.