feat(websocket): add WebSocket display backend for browser client
This commit is contained in:
@@ -8,6 +8,17 @@ from engine.events import EventType, StreamEvent
|
||||
from engine.mic import MicMonitor
|
||||
from engine.ntfy import NtfyPoller
|
||||
from engine.scroll import stream
|
||||
from engine.websocket_display import WebSocketDisplay
|
||||
|
||||
|
||||
def _get_display(config: Config):
|
||||
"""Get the appropriate display based on config."""
|
||||
if config.websocket:
|
||||
ws = WebSocketDisplay(host="0.0.0.0", port=config.websocket_port)
|
||||
ws.start_server()
|
||||
ws.start_http_server()
|
||||
return ws
|
||||
return None
|
||||
|
||||
|
||||
class StreamController:
|
||||
@@ -51,7 +62,10 @@ class StreamController:
|
||||
),
|
||||
)
|
||||
|
||||
stream(items, self.ntfy, self.mic)
|
||||
display = _get_display(self.config)
|
||||
stream(items, self.ntfy, self.mic, display)
|
||||
if display:
|
||||
display.cleanup()
|
||||
|
||||
if self.event_bus:
|
||||
self.event_bus.publish(
|
||||
|
||||
Reference in New Issue
Block a user