Route themes and translations over websocket (#14828)

This commit is contained in:
Paulus Schoutsen 2018-06-06 01:12:43 -07:00 committed by Pascal Vizeli
parent a6880c452f
commit fa2e6ada26
4 changed files with 175 additions and 88 deletions

View file

@ -38,6 +38,7 @@ MAX_PENDING_MSG = 512
ERR_ID_REUSE = 1
ERR_INVALID_FORMAT = 2
ERR_NOT_FOUND = 3
ERR_UNKNOWN_COMMAND = 4
TYPE_AUTH = 'auth'
TYPE_AUTH_INVALID = 'auth_invalid'
@ -353,8 +354,11 @@ class ActiveConnection:
'Identifier values have to increase.'))
elif msg['type'] not in handlers:
# Unknown command
break
self.log_error(
'Received invalid command: {}'.format(msg['type']))
self.to_write.put_nowait(error_message(
cur_id, ERR_UNKNOWN_COMMAND,
'Unknown command.'))
else:
handler, schema = handlers[msg['type']]