Expose a websocket server from `mach watch`

NEW
Unassigned

Status

()

Core
Build Config
5 months ago
4 months ago

People

(Reporter: bgrins, Unassigned)

Tracking

(Blocks: 1 bug)

unspecified
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox57 wontfix)

Details

(Reporter)

Description

5 months ago
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.
(Reporter)

Comment 1

5 months ago
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.

Comment 2

5 months ago
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 :)
(Reporter)

Comment 3

5 months ago
(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
(Reporter)

Updated

5 months ago
See Also: → bug 1388972
(Reporter)

Updated

5 months ago
Blocks: 1389169

Updated

4 months ago
status-firefox57: --- → wontfix
You need to log in before you can comment on or make changes to this bug.