webhooks: Require a subscription to receive gcode output

Add a new "gcode/subscribe_output" webhook endpoint to subscribe to
gcode output.  Only client connections that subscribe to the gcode
output will receive that output.

This also moves all the gcode webhooks from gcode.py to webhooks.py
and arranges for gcode.py to be initialized prior to webhooks.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2020-08-11 21:21:41 -04:00
parent 568393c941
commit 16a53e6918
3 changed files with 53 additions and 32 deletions

View File

@@ -59,7 +59,7 @@ class Printer:
self.event_handlers = {}
self.objects = collections.OrderedDict()
# Init printer components that must be setup prior to config
for m in [webhooks, gcode]:
for m in [gcode, webhooks]:
m.add_early_printer_objects(self)
def get_start_args(self):
return self.start_args