Skip to content

Commit

Permalink
fix/gui upload (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl authored Aug 16, 2023
1 parent 69296ce commit d8837f8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ovos_messagebus/event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from ovos_utils.messagebus import FakeMessage as Message
from ovos_utils.log import LOG
from ovos_config import Configuration
from pyee import EventEmitter
from tornado.websocket import WebSocketHandler

Expand All @@ -33,13 +34,23 @@ def __init__(self, application, request, **kwargs):
def on(self, event_name, handler):
self.emitter.on(event_name, handler)

@property
def max_message_size(self) -> int:
return Configuration().get("websocket", {}).get("max_msg_size", 10) * 1024 * 1024

def on_message(self, message):
LOG.debug(message)

try:
deserialized_message = Message.deserialize(message)
except Exception:
return

filter_ogs = ["gui.status.request", "gui.page.upload"]
if deserialized_message.msg_type not in filter_ogs:
LOG.debug(deserialized_message.msg_type +
f' source: {deserialized_message.context.get("source", [])}' +
f' destination: {deserialized_message.context.get("destination", [])}')

try:
self.emitter.emit(deserialized_message.msg_type,
deserialized_message)
Expand Down

0 comments on commit d8837f8

Please sign in to comment.